lib/rbs/test/guaranteed.rb in rbs-3.3.2 vs lib/rbs/test/guaranteed.rb in rbs-3.4.0.pre.1
- old
+ new
@@ -8,20 +8,19 @@
INSPECT = ::Kernel.instance_method(:inspect)
private_constant :EQUAL, :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
def inspect
string = "<#{self.class.name}:"
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 '>'
end
end