Skip to content

Commit ef0ef53

Browse files
committed
Enhanced RDoc for Net::HTTPHeader
1 parent 0af9fb9 commit ef0ef53

File tree

1 file changed

+7
-20
lines changed

1 file changed

+7
-20
lines changed

lib/net/http/header.rb

Lines changed: 7 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
#
3939
# === Field Values
4040
#
41-
# A field value may be returned as an array or as a string:
41+
# A field value may be returned as an array of strings or as a string:
4242
#
4343
# - These methods return field values as arrays:
4444
#
@@ -146,15 +146,6 @@
146146
# - #each_name: Passes each field name to the block.
147147
# - #each_value: Passes each field value to the block.
148148
#
149-
# == Hash of Headers
150-
#
151-
# Each of the iterator methods above returns a hash of the headers of +self+.
152-
# Note that modifying that returned hash actually modifies the headers:
153-
#
154-
# h = req.each_header {|k, v| }
155-
# h.clear
156-
# req.to_hash # => {}
157-
#
158149
module Net::HTTPHeader
159150

160151
def initialize_http_header(initheader) #:nodoc:
@@ -280,10 +271,12 @@ def get_fields(key)
280271
end
281272

282273
# :call-seq
283-
# fetch(key, default_val = nil) {|key| ... }
274+
# fetch(key, default_val = nil) {|key| ... } -> object
275+
# fetch(key, default_val = nil) value or default_val
284276
#
285277
# With a block, returns the string value for +key+ if it exists;
286278
# otherwise returns the value of the block;
279+
# ignores the +default_val+;
287280
# see {Fields}[rdoc-ref:Net::HTTPHeader@Fields]:
288281
#
289282
# req = Net::HTTP::Get.new(uri)
@@ -304,9 +297,7 @@ def fetch(key, *args, &block) #:yield: +key+
304297
a.kind_of?(Array) ? a.join(', ') : a
305298
end
306299

307-
# Calls the block with each key/value pair;
308-
# returns the {hash of headers}[rdoc-ref:Net::HTTPHeader@Hash+of+Headers];
309-
# see {Fields}[rdoc-ref:Net::HTTPHeader@Fields]:
300+
# Calls the block with each key/value pair:
310301
#
311302
# req = Net::HTTP::Get.new(uri)
312303
# req.each_header {|key, value| p [key, value] }
@@ -330,9 +321,7 @@ def each_header #:yield: +key+, +value+
330321

331322
alias each each_header
332323

333-
# Calls the block with each field key;
334-
# returns the {hash of headers}[rdoc-ref:Net::HTTPHeader@Hash+of+Headers];
335-
# see {Fields}[rdoc-ref:Net::HTTPHeader@Fields]:
324+
# Calls the block with each field key:
336325
#
337326
# req = Net::HTTP::Get.new(uri)
338327
# req.each_key {|key| p key }
@@ -354,9 +343,7 @@ def each_name(&block) #:yield: +key+
354343

355344
alias each_key each_name
356345

357-
# Calls the block with each capitalized field name;
358-
# returns the {hash of headers}[rdoc-ref:Net::HTTPHeader@Hash+of+Headers];
359-
# see {Fields}[rdoc-ref:Net::HTTPHeader@Fields]:
346+
# Calls the block with each capitalized field name:
360347
#
361348
# req = Net::HTTP::Get.new(uri)
362349
# req.each_capitalized_name {|key| p key }

0 commit comments

Comments
 (0)