@@ -82,7 +82,7 @@ def self.build2(args)
8282 if args . kind_of? ( Array )
8383 return self . build ( args . collect { |x |
8484 if x . is_a? ( String )
85- DEFAULT_PARSER . escape ( x )
85+ Bundler :: URI :: RFC2396_PARSER . escape ( x )
8686 else
8787 x
8888 end
@@ -91,7 +91,7 @@ def self.build2(args)
9191 tmp = { }
9292 args . each do |key , value |
9393 tmp [ key ] = if value
94- DEFAULT_PARSER . escape ( value )
94+ Bundler :: URI :: RFC2396_PARSER . escape ( value )
9595 else
9696 value
9797 end
@@ -393,7 +393,7 @@ def check_userinfo(user, password = nil)
393393 def check_user ( v )
394394 if @opaque
395395 raise InvalidURIError ,
396- "can not set user with opaque"
396+ "cannot set user with opaque"
397397 end
398398
399399 return v unless v
@@ -417,7 +417,7 @@ def check_user(v)
417417 def check_password ( v , user = @user )
418418 if @opaque
419419 raise InvalidURIError ,
420- "can not set password with opaque"
420+ "cannot set password with opaque"
421421 end
422422 return v unless v
423423
@@ -596,7 +596,7 @@ def check_host(v)
596596
597597 if @opaque
598598 raise InvalidURIError ,
599- "can not set host with registry or opaque"
599+ "cannot set host with registry or opaque"
600600 elsif parser . regexp [ :HOST ] !~ v
601601 raise InvalidComponentError ,
602602 "bad component(expected host component): #{ v } "
@@ -685,7 +685,7 @@ def check_port(v)
685685
686686 if @opaque
687687 raise InvalidURIError ,
688- "can not set port with registry or opaque"
688+ "cannot set port with registry or opaque"
689689 elsif !v . kind_of? ( Integer ) && parser . regexp [ :PORT ] !~ v
690690 raise InvalidComponentError ,
691691 "bad component(expected port component): #{ v . inspect } "
@@ -733,17 +733,17 @@ def port=(v)
733733 end
734734
735735 def check_registry ( v ) # :nodoc:
736- raise InvalidURIError , "can not set registry"
736+ raise InvalidURIError , "cannot set registry"
737737 end
738738 private :check_registry
739739
740740 def set_registry ( v ) #:nodoc:
741- raise InvalidURIError , "can not set registry"
741+ raise InvalidURIError , "cannot set registry"
742742 end
743743 protected :set_registry
744744
745745 def registry = ( v )
746- raise InvalidURIError , "can not set registry"
746+ raise InvalidURIError , "cannot set registry"
747747 end
748748
749749 #
@@ -866,7 +866,7 @@ def check_opaque(v)
866866 # hier_part = ( net_path | abs_path ) [ "?" query ]
867867 if @host || @port || @user || @path # userinfo = @user + ':' + @password
868868 raise InvalidURIError ,
869- "can not set opaque with host, port, userinfo or path"
869+ "cannot set opaque with host, port, userinfo or path"
870870 elsif v && parser . regexp [ :OPAQUE ] !~ v
871871 raise InvalidComponentError ,
872872 "bad component(expected opaque component): #{ v } "
@@ -945,7 +945,7 @@ def fragment=(v)
945945 # == Description
946946 #
947947 # Bundler::URI has components listed in order of decreasing significance from left to right,
948- # see RFC3986 https://tools.ietf .org/html /rfc3986 1.2.3.
948+ # see RFC3986 https://www.rfc-editor .org/rfc /rfc3986 1.2.3.
949949 #
950950 # == Usage
951951 #
@@ -1235,7 +1235,7 @@ def route_from0(oth)
12351235 return rel , rel
12361236 end
12371237
1238- # you can modify `rel', but can not `oth'.
1238+ # you can modify `rel', but cannot `oth'.
12391239 return oth , rel
12401240 end
12411241 private :route_from0
@@ -1260,7 +1260,7 @@ def route_from0(oth)
12601260 # #=> #<Bundler::URI::Generic /main.rbx?page=1>
12611261 #
12621262 def route_from ( oth )
1263- # you can modify `rel', but can not `oth'.
1263+ # you can modify `rel', but cannot `oth'.
12641264 begin
12651265 oth , rel = route_from0 ( oth )
12661266 rescue
@@ -1364,6 +1364,9 @@ def to_s
13641364 str << ':'
13651365 str << @port . to_s
13661366 end
1367+ if ( @host || @port ) && !@path . empty? && !@path . start_with? ( '/' )
1368+ str << '/'
1369+ end
13671370 str << @path
13681371 if @query
13691372 str << '?'
@@ -1399,19 +1402,6 @@ def eql?(oth)
13991402 self . component_ary . eql? ( oth . component_ary )
14001403 end
14011404
1402- =begin
1403-
1404- --- Bundler::URI::Generic#===(oth)
1405-
1406- =end
1407- # def ===(oth)
1408- # raise NotImplementedError
1409- # end
1410-
1411- =begin
1412- =end
1413-
1414-
14151405 # Returns an Array of the components defined from the COMPONENT Array.
14161406 def component_ary
14171407 component . collect do |x |
0 commit comments