Skip to content

Commit

Permalink
Merge pull request #1650 from sampersand/swesterman/23-11-26/bugfix-R…
Browse files Browse the repository at this point in the history
…BS.Test.Errors.inspect_

Bugfix; `.respond_to` is no longer used in `Rbs::Test::Errors#inspect_`
  • Loading branch information
soutaro authored Nov 27, 2023
2 parents a15863f + f56a48e commit b9930cb
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/rbs/test/errors.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,11 @@ def self.format_param(param)
end
end

RESPOND_TO = ::Kernel.instance_method :respond_to?
private_constant :RESPOND_TO

def self.inspect_(obj)
if obj.respond_to?(:inspect)
if RESPOND_TO.bind_call(obj, :inspect)
obj.inspect
else
Test::INSPECT.bind(obj).call # For the case inspect is not defined (like BasicObject)
Expand Down

0 comments on commit b9930cb

Please sign in to comment.