diff options
author | BurdetteLamar <burdettelamar@yahoo.com> | 2022-11-23 13:06:47 +0000 |
---|---|---|
committer | git <svn-admin@ruby-lang.org> | 2022-11-23 17:12:34 +0000 |
commit | 4b32ed6e33d5a15e22b2f729257ef287e4c964c1 (patch) | |
tree | 2596827f754e8b3af3a250365217889f9995db64 /lib | |
parent | 79a9280aa59558018d9255b30b596faf1f4ba912 (diff) |
[ruby/net-http] Enhanced RDoc for Net::HTTPHeader
https://github.com/ruby/net-http/commit/ef0ef53b0c
Diffstat (limited to 'lib')
-rw-r--r-- | lib/net/http/header.rb | 27 |
1 files changed, 7 insertions, 20 deletions
diff --git a/lib/net/http/header.rb b/lib/net/http/header.rb index 02d0252c0d..01c6189089 100644 --- a/lib/net/http/header.rb +++ b/lib/net/http/header.rb @@ -38,7 +38,7 @@ # # === Field Values # -# A field value may be returned as an array or as a string: +# A field value may be returned as an array of strings or as a string: # # - These methods return field values as arrays: # @@ -146,15 +146,6 @@ # - #each_name: Passes each field name to the block. # - #each_value: Passes each field value to the block. # -# == Hash of Headers -# -# Each of the iterator methods above returns a hash of the headers of +self+. -# Note that modifying that returned hash actually modifies the headers: -# -# h = req.each_header {|k, v| } -# h.clear -# req.to_hash # => {} -# module Net::HTTPHeader def initialize_http_header(initheader) #:nodoc: @@ -280,10 +271,12 @@ module Net::HTTPHeader end # :call-seq - # fetch(key, default_val = nil) {|key| ... } + # fetch(key, default_val = nil) {|key| ... } -> object + # fetch(key, default_val = nil) value or default_val # # With a block, returns the string value for +key+ if it exists; # otherwise returns the value of the block; + # ignores the +default_val+; # see {Fields}[rdoc-ref:Net::HTTPHeader@Fields]: # # req = Net::HTTP::Get.new(uri) @@ -304,9 +297,7 @@ module Net::HTTPHeader a.kind_of?(Array) ? a.join(', ') : a end - # Calls the block with each key/value pair; - # returns the {hash of headers}[rdoc-ref:Net::HTTPHeader@Hash+of+Headers]; - # see {Fields}[rdoc-ref:Net::HTTPHeader@Fields]: + # Calls the block with each key/value pair: # # req = Net::HTTP::Get.new(uri) # req.each_header {|key, value| p [key, value] } @@ -330,9 +321,7 @@ module Net::HTTPHeader alias each each_header - # Calls the block with each field key; - # returns the {hash of headers}[rdoc-ref:Net::HTTPHeader@Hash+of+Headers]; - # see {Fields}[rdoc-ref:Net::HTTPHeader@Fields]: + # Calls the block with each field key: # # req = Net::HTTP::Get.new(uri) # req.each_key {|key| p key } @@ -354,9 +343,7 @@ module Net::HTTPHeader alias each_key each_name - # Calls the block with each capitalized field name; - # returns the {hash of headers}[rdoc-ref:Net::HTTPHeader@Hash+of+Headers]; - # see {Fields}[rdoc-ref:Net::HTTPHeader@Fields]: + # Calls the block with each capitalized field name: # # req = Net::HTTP::Get.new(uri) # req.each_capitalized_name {|key| p key } |