lib/bundler/vendor/uri/lib/uri/rfc2396_parser.rb in bundler-2.3.27 vs lib/bundler/vendor/uri/lib/uri/rfc2396_parser.rb in bundler-2.4.0

- old
+ new

@@ -114,11 +114,11 @@ # The Hash of Regexp. # # See also Bundler::URI::Parser.initialize_regexp. attr_reader :regexp - # Returns a split Bundler::URI against regexp[:ABS_URI]. + # Returns a split Bundler::URI against +regexp[:ABS_URI]+. def split(uri) case uri when '' # null uri @@ -255,12 +255,12 @@ str.scan(make_regexp(schemes)) { result.push $& } result end end - # Returns Regexp that is default self.regexp[:ABS_URI_REF], - # unless +schemes+ is provided. Then it is a Regexp.union with self.pattern[:X_ABS_URI]. + # Returns Regexp that is default +self.regexp[:ABS_URI_REF]+, + # unless +schemes+ is provided. Then it is a Regexp.union with +self.pattern[:X_ABS_URI]+. def make_regexp(schemes = nil) unless schemes @regexp[:ABS_URI_REF] else /(?=#{Regexp.union(*schemes)}:)#{@pattern[:X_ABS_URI]}/x @@ -275,11 +275,11 @@ # == Args # # +str+:: # String to make safe # +unsafe+:: - # Regexp to apply. Defaults to self.regexp[:UNSAFE] + # Regexp to apply. Defaults to +self.regexp[:UNSAFE]+ # # == Description # # Constructs a safe String from +str+, removing unsafe characters, # replacing them with codes. @@ -307,11 +307,11 @@ # == Args # # +str+:: # String to remove escapes from # +escaped+:: - # Regexp to apply. Defaults to self.regexp[:ESCAPED] + # Regexp to apply. Defaults to +self.regexp[:ESCAPED]+ # # == Description # # Removes escapes from +str+. # @@ -320,11 +320,17 @@ enc = Encoding::UTF_8 if enc == Encoding::US_ASCII str.gsub(escaped) { [$&[1, 2]].pack('H2').force_encoding(enc) } 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 # Constructs the default Hash of patterns.