[ruby/uri] Only use UnboundMethod#bind_call if it is available
This allows tests to pass on Ruby 2.4-2.6. Fixes #19 https://github.com/ruby/uri/commit/67ca99ca87
This commit is contained in:
parent
3e27ca6047
commit
10ad81eb2d
@ -322,9 +322,15 @@ module URI
|
||||
end
|
||||
|
||||
@@to_s = Kernel.instance_method(:to_s)
|
||||
if @@to_s.respond_to?(:bind_call)
|
||||
def inspect
|
||||
@@to_s.bind_call(self)
|
||||
end
|
||||
else
|
||||
def inspect
|
||||
@@to_s.bind(self).call
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
|
@ -79,9 +79,15 @@ module URI
|
||||
end
|
||||
|
||||
@@to_s = Kernel.instance_method(:to_s)
|
||||
if @@to_s.respond_to?(:bind_call)
|
||||
def inspect
|
||||
@@to_s.bind_call(self)
|
||||
end
|
||||
else
|
||||
def inspect
|
||||
@@to_s.bind(self).call
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user