diff options
author | Jeremy Evans <code@jeremyevans.net> | 2021-03-04 15:19:25 -0800 |
---|---|---|
committer | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2021-04-22 14:54:47 +0900 |
commit | 10ad81eb2d4bf44b5d5350e3ea28e6248f550128 (patch) | |
tree | 1a8b341e6edeea382e6d42696f2af4ae3721200c /lib/uri/rfc3986_parser.rb | |
parent | 3e27ca60470cbd73dd82ca6b8007a3b8362d576e (diff) |
[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
Diffstat (limited to 'lib/uri/rfc3986_parser.rb')
-rw-r--r-- | lib/uri/rfc3986_parser.rb | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/uri/rfc3986_parser.rb b/lib/uri/rfc3986_parser.rb index 49a594c17d..3e07de4805 100644 --- a/lib/uri/rfc3986_parser.rb +++ b/lib/uri/rfc3986_parser.rb @@ -79,8 +79,14 @@ module URI end @@to_s = Kernel.instance_method(:to_s) - def inspect - @@to_s.bind_call(self) + 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 |