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

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/protocol/http/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.



288
289
290
# File 'lib/protocol/http/headers.rb', line 288

def initialize(*all)
	@all = all
end

Instance Method Details

#<<(headers) ⇒ Object



296
297
298
299
300
# File 'lib/protocol/http/headers.rb', line 296

def << headers
	@all << headers
	
	return self
end

#clearObject



292
293
294
# File 'lib/protocol/http/headers.rb', line 292

def clear
	@all.clear
end

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

Yields:

  • (String, String)

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



303
304
305
306
307
308
309
# File 'lib/protocol/http/headers.rb', line 303

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