[ruby/net-http] Enhanced RDoc for Net::HTTPHeader
https://github.com/ruby/net-http/commit/ef0ef53b0c
This commit is contained in:
parent
79a9280aa5
commit
4b32ed6e33
@ -38,7 +38,7 @@
|
|||||||
#
|
#
|
||||||
# === Field Values
|
# === 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:
|
# - These methods return field values as arrays:
|
||||||
#
|
#
|
||||||
@ -146,15 +146,6 @@
|
|||||||
# - #each_name: Passes each field name to the block.
|
# - #each_name: Passes each field name to the block.
|
||||||
# - #each_value: Passes each field value 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
|
module Net::HTTPHeader
|
||||||
|
|
||||||
def initialize_http_header(initheader) #:nodoc:
|
def initialize_http_header(initheader) #:nodoc:
|
||||||
@ -280,10 +271,12 @@ module Net::HTTPHeader
|
|||||||
end
|
end
|
||||||
|
|
||||||
# :call-seq
|
# :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;
|
# With a block, returns the string value for +key+ if it exists;
|
||||||
# otherwise returns the value of the block;
|
# otherwise returns the value of the block;
|
||||||
|
# ignores the +default_val+;
|
||||||
# see {Fields}[rdoc-ref:Net::HTTPHeader@Fields]:
|
# see {Fields}[rdoc-ref:Net::HTTPHeader@Fields]:
|
||||||
#
|
#
|
||||||
# req = Net::HTTP::Get.new(uri)
|
# req = Net::HTTP::Get.new(uri)
|
||||||
@ -304,9 +297,7 @@ module Net::HTTPHeader
|
|||||||
a.kind_of?(Array) ? a.join(', ') : a
|
a.kind_of?(Array) ? a.join(', ') : a
|
||||||
end
|
end
|
||||||
|
|
||||||
# Calls the block with each key/value pair;
|
# 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]:
|
|
||||||
#
|
#
|
||||||
# req = Net::HTTP::Get.new(uri)
|
# req = Net::HTTP::Get.new(uri)
|
||||||
# req.each_header {|key, value| p [key, value] }
|
# req.each_header {|key, value| p [key, value] }
|
||||||
@ -330,9 +321,7 @@ module Net::HTTPHeader
|
|||||||
|
|
||||||
alias each each_header
|
alias each each_header
|
||||||
|
|
||||||
# Calls the block with each field key;
|
# 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]:
|
|
||||||
#
|
#
|
||||||
# req = Net::HTTP::Get.new(uri)
|
# req = Net::HTTP::Get.new(uri)
|
||||||
# req.each_key {|key| p key }
|
# req.each_key {|key| p key }
|
||||||
@ -354,9 +343,7 @@ module Net::HTTPHeader
|
|||||||
|
|
||||||
alias each_key each_name
|
alias each_key each_name
|
||||||
|
|
||||||
# Calls the block with each capitalized field 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]:
|
|
||||||
#
|
#
|
||||||
# req = Net::HTTP::Get.new(uri)
|
# req = Net::HTTP::Get.new(uri)
|
||||||
# req.each_capitalized_name {|key| p key }
|
# req.each_capitalized_name {|key| p key }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user