38
38
#
39
39
# === Field Values
40
40
#
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:
42
42
#
43
43
# - These methods return field values as arrays:
44
44
#
146
146
# - #each_name: Passes each field name to the block.
147
147
# - #each_value: Passes each field value to the block.
148
148
#
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
- #
158
149
module Net ::HTTPHeader
159
150
160
151
def initialize_http_header ( initheader ) #:nodoc:
@@ -280,10 +271,12 @@ def get_fields(key)
280
271
end
281
272
282
273
# :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
284
276
#
285
277
# With a block, returns the string value for +key+ if it exists;
286
278
# otherwise returns the value of the block;
279
+ # ignores the +default_val+;
287
280
# see {Fields}[rdoc-ref:Net::HTTPHeader@Fields]:
288
281
#
289
282
# req = Net::HTTP::Get.new(uri)
@@ -304,9 +297,7 @@ def fetch(key, *args, &block) #:yield: +key+
304
297
a . kind_of? ( Array ) ? a . join ( ', ' ) : a
305
298
end
306
299
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:
310
301
#
311
302
# req = Net::HTTP::Get.new(uri)
312
303
# req.each_header {|key, value| p [key, value] }
@@ -330,9 +321,7 @@ def each_header #:yield: +key+, +value+
330
321
331
322
alias each each_header
332
323
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:
336
325
#
337
326
# req = Net::HTTP::Get.new(uri)
338
327
# req.each_key {|key| p key }
@@ -354,9 +343,7 @@ def each_name(&block) #:yield: +key+
354
343
355
344
alias each_key each_name
356
345
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:
360
347
#
361
348
# req = Net::HTTP::Get.new(uri)
362
349
# req.each_capitalized_name {|key| p key }
0 commit comments