diff options
-rw-r--r-- | lib/uri/rfc2396_parser.rb | 10 | ||||
-rw-r--r-- | lib/uri/rfc3986_parser.rb | 10 |
2 files changed, 16 insertions, 4 deletions
diff --git a/lib/uri/rfc2396_parser.rb b/lib/uri/rfc2396_parser.rb index 1c9ce177bc..76a8f99fd4 100644 --- a/lib/uri/rfc2396_parser.rb +++ b/lib/uri/rfc2396_parser.rb @@ -322,8 +322,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 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 |