зеркало из https://github.com/github/ruby.git
* lib/net/http.rb (each_*): return enumerator if no block present. Patch by Arthur Schreiber [ruby-core:18310]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24915 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
5904f64dbf
Коммит
b09845fa70
|
@ -1,3 +1,8 @@
|
|||
Mon Sep 14 08:33:11 2009 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
|
||||
|
||||
* lib/net/http.rb (each_*): return enumerator if no block present.
|
||||
Patch by Arthur Schreiber [ruby-core:18310]
|
||||
|
||||
Mon Sep 14 06:42:21 2009 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
|
||||
|
||||
* lib/cgi/cookie.rb (value): Keep CGI::Cookie#value in sync with the
|
||||
|
|
|
@ -1302,6 +1302,7 @@ module Net #:nodoc:
|
|||
|
||||
# Iterates for each header names and values.
|
||||
def each_header #:yield: +key+, +value+
|
||||
block_given? or return enum_for(__method__)
|
||||
@header.each do |k,va|
|
||||
yield k, va.join(', ')
|
||||
end
|
||||
|
@ -1311,13 +1312,15 @@ module Net #:nodoc:
|
|||
|
||||
# Iterates for each header names.
|
||||
def each_name(&block) #:yield: +key+
|
||||
block_given? or return enum_for(__method__)
|
||||
@header.each_key(&block)
|
||||
end
|
||||
|
||||
alias each_key each_name
|
||||
|
||||
# Iterates for each capitalized header names.
|
||||
def each_capitalized_name(&block) #:yield: +key+
|
||||
def each_capitalized_name #:yield: +key+
|
||||
block_given? or return enum_for(__method__)
|
||||
@header.each_key do |k|
|
||||
yield capitalize(k)
|
||||
end
|
||||
|
@ -1325,6 +1328,7 @@ module Net #:nodoc:
|
|||
|
||||
# Iterates for each header values.
|
||||
def each_value #:yield: +value+
|
||||
block_given? or return enum_for(__method__)
|
||||
@header.each_value do |va|
|
||||
yield va.join(', ')
|
||||
end
|
||||
|
@ -1347,6 +1351,7 @@ module Net #:nodoc:
|
|||
|
||||
# As for #each_header, except the keys are provided in capitalized form.
|
||||
def each_capitalized
|
||||
block_given? or return enum_for(__method__)
|
||||
@header.each do |k,v|
|
||||
yield capitalize(k), v.join(', ')
|
||||
end
|
||||
|
|
Загрузка…
Ссылка в новой задаче