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 # Iterates through the header names and values, passing in the name
# and value to the code block supplied. # and value to the code block supplied.
# #
# Returns an enumerator if no block is given.
#
# Example: # Example:
# #
# response.header.each_header {|key,value| puts "#{key} = #{value}" } # 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 # Iterates through the header names in the header, passing
# each header name to the code block. # each header name to the code block.
#
# Returns an enumerator if no block is given.
def each_name(&block) #:yield: +key+ def each_name(&block) #:yield: +key+
block_given? or return enum_for(__method__) { @header.size } block_given? or return enum_for(__method__) { @header.size }
@header.each_key(&block) @header.each_key(&block)
@ -124,6 +128,8 @@ module Net::HTTPHeader
# Note that header names are capitalized systematically; # Note that header names are capitalized systematically;
# capitalization may not match that used by the remote HTTP # capitalization may not match that used by the remote HTTP
# server in its response. # server in its response.
#
# Returns an enumerator if no block is given.
def each_capitalized_name #:yield: +key+ def each_capitalized_name #:yield: +key+
block_given? or return enum_for(__method__) { @header.size } block_given? or return enum_for(__method__) { @header.size }
@header.each_key do |k| @header.each_key do |k|
@ -133,6 +139,8 @@ module Net::HTTPHeader
# Iterates through header values, passing each value to the # Iterates through header values, passing each value to the
# code block. # code block.
#
# Returns an enumerator if no block is given.
def each_value #:yield: +value+ def each_value #:yield: +value+
block_given? or return enum_for(__method__) { @header.size } block_given? or return enum_for(__method__) { @header.size }
@header.each_value do |va| @header.each_value do |va|
@ -164,6 +172,8 @@ module Net::HTTPHeader
# Note that header names are capitalized systematically; # Note that header names are capitalized systematically;
# capitalization may not match that used by the remote HTTP # capitalization may not match that used by the remote HTTP
# server in its response. # server in its response.
#
# Returns an enumerator if no block is given.
def each_capitalized def each_capitalized
block_given? or return enum_for(__method__) { @header.size } block_given? or return enum_for(__method__) { @header.size }
@header.each do |k,v| @header.each do |k,v|