diff options
author | ktsj <ktsj@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-05-04 09:46:46 +0000 |
---|---|---|
committer | ktsj <ktsj@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-05-04 09:46:46 +0000 |
commit | 6da221411969e8be9ed0793b23ed8224561ed20f (patch) | |
tree | dcfa936bb063f6c2a75454c8d87adf043257c2db /lib/net | |
parent | 803177b38e5bc3ead7c5e5903f5f8135cd4b30a5 (diff) | |
download | ruby-6da221411969e8be9ed0793b23ed8224561ed20f.tar.gz |
* lib/net/http/header.rb (Net::HTTPHeader#{each_header,each_name,
each_capitalized_name,each_value,each_capitalized}): Return
sized enumerators.
* test/net/http/test_httpheader.rb: add test for above.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54906 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/net')
-rw-r--r-- | lib/net/http/header.rb | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/net/http/header.rb b/lib/net/http/header.rb index 59980caef6..bc4cce9098 100644 --- a/lib/net/http/header.rb +++ b/lib/net/http/header.rb @@ -101,7 +101,7 @@ module Net::HTTPHeader # response.header.each_header {|key,value| puts "#{key} = #{value}" } # def each_header #:yield: +key+, +value+ - block_given? or return enum_for(__method__) + block_given? or return enum_for(__method__) { @header.size } @header.each do |k,va| yield k, va.join(', ') end @@ -112,7 +112,7 @@ module Net::HTTPHeader # Iterates through the header names in the header, passing # each header name to the code block. def each_name(&block) #:yield: +key+ - block_given? or return enum_for(__method__) + block_given? or return enum_for(__method__) { @header.size } @header.each_key(&block) end @@ -125,7 +125,7 @@ module Net::HTTPHeader # capitalization may not match that used by the remote HTTP # server in its response. def each_capitalized_name #:yield: +key+ - block_given? or return enum_for(__method__) + block_given? or return enum_for(__method__) { @header.size } @header.each_key do |k| yield capitalize(k) end @@ -134,7 +134,7 @@ module Net::HTTPHeader # Iterates through header values, passing each value to the # code block. def each_value #:yield: +value+ - block_given? or return enum_for(__method__) + block_given? or return enum_for(__method__) { @header.size } @header.each_value do |va| yield va.join(', ') end @@ -165,7 +165,7 @@ module Net::HTTPHeader # capitalization may not match that used by the remote HTTP # server in its response. def each_capitalized - block_given? or return enum_for(__method__) + block_given? or return enum_for(__method__) { @header.size } @header.each do |k,v| yield capitalize(k), v.join(', ') end |