Skip to content

Commit

Permalink
Net::HTTPHeader#each_capitalized_name when passed no block returns an…
Browse files Browse the repository at this point in the history
… Enumerator

Net::HTTPHeader#each_capitalized when passed no block returns an Enumerator
  • Loading branch information
p8 committed Oct 8, 2011
1 parent ebcd706 commit 95d1781
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/net/http.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1231,6 +1231,7 @@ def each_name(&block) #:yield: +key+

# Iterates for each capitalized header names.
def each_capitalized_name(&block) #:yield: +key+
return to_enum(__method__) unless block_given?
@header.each_key do |k|
yield capitalize(k)
end
Expand Down Expand Up @@ -1261,6 +1262,7 @@ def to_hash

# As for #each_header, except the keys are provided in capitalized form.
def each_capitalized
return to_enum(__method__) unless block_given?
@header.each do |k,v|
yield capitalize(k), v.join(', ')
end
Expand Down

0 comments on commit 95d1781

Please sign in to comment.