1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* 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
This commit is contained in:
ktsj 2016-05-04 09:46:48 +00:00
parent 6da2214119
commit 02377a3a79

View file

@ -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|