Class: HTTP::Protocol::Headers::Merged

Inherits:
Object
  • Object
show all
Defined in:
lib/http/protocol/headers.rb

Overview

Used for merging objects into a sequential list of headers. Normalizes header keys and values.

Instance Method Summary collapse

Constructor Details

#initialize(*all) ⇒ Merged

Returns a new instance of Merged.



209
210
211
# File 'lib/http/protocol/headers.rb', line 209

def initialize(*all)
  @all = all
end

Instance Method Details

#<<(headers) ⇒ Object



213
214
215
# File 'lib/http/protocol/headers.rb', line 213

def << headers
  @all << headers
end

#each {|String, String| ... } ⇒ Object

Yields:

  • (String, String)

    header key (lower case) and value (as string).



218
219
220
221
222
223
224
# File 'lib/http/protocol/headers.rb', line 218

def each(&block)
  @all.each do |headers|
    headers.each do |key, value|
      yield key.downcase, value.to_s
    end
  end
end