Project

General

Profile

Bug #447 ยป net_httpheader_iterators.patch

NoKarma (Arthur Schreiber), 08/15/2008 09:57 PM

View differences:

lib/net/http.rb (Arbeitskopie)
# 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
......
alias each each_header
# Iterates for each header names.
def each_name(&block) #:yield: +key+
@header.each_key(&block)
def each_name #:yield: +key+
block_given? or return enum_for(__method__)
@header.each_key { |key| yield key }
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
......
# 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
......
# 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
    (1-1/1)