ruby-changes:45953
From: stomar <ko1@a...>
Date: Mon, 20 Mar 2017 00:01:12 +0900 (JST)
Subject: [ruby-changes:45953] stomar:r58023 (trunk): improve docs for URI::Generic
stomar 2017-03-20 00:01:05 +0900 (Mon, 20 Mar 2017) New Revision: 58023 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=58023 Log: improve docs for URI::Generic * lib/uri/generic.rb: [DOC] expand docs for URI::Generic#normalize to clarify what normalization means here. Reported by Robert Gleeson. [ruby-core:58430] [Bug #9127] * lib/uri/generic.rb: [DOC] fix indent for correct code block detection. Modified files: trunk/lib/uri/generic.rb Index: lib/uri/generic.rb =================================================================== --- lib/uri/generic.rb (revision 58022) +++ lib/uri/generic.rb (revision 58023) @@ -271,7 +271,7 @@ module URI https://github.com/ruby/ruby/blob/trunk/lib/uri/generic.rb#L271 # # Portion of the path that does make use of the slash '/'. # The path typically refers to the absolute path and the opaque part. - # (see RFC2396 Section 3 and 5.2) + # (See RFC2396 Section 3 and 5.2.) # attr_reader :opaque @@ -643,9 +643,9 @@ module URI https://github.com/ruby/ruby/blob/trunk/lib/uri/generic.rb#L643 # This method is same as URI::Generic#host except # brackets for IPv6 (and future IP) addresses are removed. # - # u = URI("http://[::1]/bar") - # p u.hostname #=> "::1" - # p u.host #=> "[::1]" + # u = URI("http://[::1]/bar") + # p u.hostname #=> "::1" + # p u.host #=> "[::1]" # def hostname v = self.host @@ -657,10 +657,10 @@ module URI https://github.com/ruby/ruby/blob/trunk/lib/uri/generic.rb#L657 # This method is same as URI::Generic#host= except # the argument can be bare IPv6 address. # - # u = URI("http://foo/bar") - # p u.to_s #=> "http://foo/bar" - # u.hostname = "::1" - # p u.to_s #=> "http://[::1]/bar" + # u = URI("http://foo/bar") + # p u.to_s #=> "http://foo/bar" + # u.hostname = "::1" + # p u.to_s #=> "http://[::1]/bar" # # If the argument seems IPv6 address, # it is wrapped by brackets. @@ -1293,7 +1293,17 @@ module URI https://github.com/ruby/ruby/blob/trunk/lib/uri/generic.rb#L1293 end # - # Returns normalized URI + # Returns normalized URI. + # + # require 'uri' + # + # URI("HTTP://my.EXAMPLE.com").normalize + # #=> #<URI::HTTP http://my.example.com/> + # + # Normalization here means: + # + # * scheme and host are converted to lowercase, + # * an empty path component is set to "/". # def normalize uri = dup @@ -1438,8 +1448,8 @@ module URI https://github.com/ruby/ruby/blob/trunk/lib/uri/generic.rb#L1448 # # == Description # - # attempt to parse other URI +oth+ - # return [parsed_oth, self] + # attempts to parse other URI +oth+, + # returns [parsed_oth, self] # # == Usage # -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/