aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorktsj <ktsj@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-05-04 09:46:48 +0000
committerktsj <ktsj@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-05-04 09:46:48 +0000
commit02377a3a79843aa9c734a875853870688fde57be (patch)
tree11da1f8f4ea37c20f1b68b7ff149112c6e20c635
parent6da221411969e8be9ed0793b23ed8224561ed20f (diff)
downloadruby-02377a3a79843aa9c734a875853870688fde57be.tar.gz
* lib/net/http/header.rb: [DOC] add documentation that
Net::HTTPHeader#{each_header,each_name,each_capitalized_name, each_value,each_capitalized} without block returns an enumerator. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54907 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--lib/net/http/header.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/net/http/header.rb b/lib/net/http/header.rb
index bc4cce9098..9a6a360fe2 100644
--- a/lib/net/http/header.rb
+++ b/lib/net/http/header.rb
@@ -96,6 +96,8 @@ module Net::HTTPHeader
# Iterates through the header names and values, passing in the name
# and value to the code block supplied.
#
+ # Returns an enumerator if no block is given.
+ #
# Example:
#
# response.header.each_header {|key,value| puts "#{key} = #{value}" }
@@ -111,6 +113,8 @@ module Net::HTTPHeader
# Iterates through the header names in the header, passing
# each header name to the code block.
+ #
+ # Returns an enumerator if no block is given.
def each_name(&block) #:yield: +key+
block_given? or return enum_for(__method__) { @header.size }
@header.each_key(&block)
@@ -124,6 +128,8 @@ module Net::HTTPHeader
# Note that header names are capitalized systematically;
# capitalization may not match that used by the remote HTTP
# server in its response.
+ #
+ # Returns an enumerator if no block is given.
def each_capitalized_name #:yield: +key+
block_given? or return enum_for(__method__) { @header.size }
@header.each_key do |k|
@@ -133,6 +139,8 @@ module Net::HTTPHeader
# Iterates through header values, passing each value to the
# code block.
+ #
+ # Returns an enumerator if no block is given.
def each_value #:yield: +value+
block_given? or return enum_for(__method__) { @header.size }
@header.each_value do |va|
@@ -164,6 +172,8 @@ module Net::HTTPHeader
# Note that header names are capitalized systematically;
# capitalization may not match that used by the remote HTTP
# server in its response.
+ #
+ # Returns an enumerator if no block is given.
def each_capitalized
block_given? or return enum_for(__method__) { @header.size }
@header.each do |k,v|