Skip to content

Commit

Permalink
Small bugfix to have guaranteed print out instance variables
Browse files Browse the repository at this point in the history
  • Loading branch information
sampersand committed Nov 24, 2023
1 parent 47a57ff commit 4c282f3
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions lib/rbs/test/guaranteed.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ module Inspect

module_function def guaranteed_inspect(obj)
obj.inspect
rescue NoMethodError => err
raise unless err.name == :inspect && EQUAL.bind_call(obj, err.receiver)
rescue NoMethodError
INSPECT.bind_call(obj)
end

Expand All @@ -20,7 +19,7 @@ def inspect

instance_variables.each_with_index do |variable, index|
string.concat ', ' unless index.zero?
string.concat "#{variable}: #{guaranteed_inspect(variable)}"
string.concat "#{variable}: #{guaranteed_inspect(instance_variable_get(variable))}"
end

string.concat '>'
Expand Down

0 comments on commit 4c282f3

Please sign in to comment.