Class: HttpStub::Server::Request::Headers
- Inherits:
-
Hash
- Object
- Hash
- HttpStub::Server::Request::Headers
- Includes:
- Extensions::Core::Hash::Formatted, Extensions::Core::Hash::IndifferentAndInsensitiveAccess
- Defined in:
- lib/http_stub/server/request/headers.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(header_hash = {}) ⇒ Headers
constructor
A new instance of Headers.
Methods included from Extensions::Core::Hash::Formatted
Methods included from Extensions::Core::Hash::IndifferentAndInsensitiveAccess
Constructor Details
#initialize(header_hash = {}) ⇒ Headers
Returns a new instance of Headers.
16 17 18 |
# File 'lib/http_stub/server/request/headers.rb', line 16 def initialize(header_hash={}) super(header_hash, ":") end |
Class Method Details
.create(rack_request) ⇒ Object
9 10 11 12 13 14 |
# File 'lib/http_stub/server/request/headers.rb', line 9 def self.create(rack_request) rack_request.env.each_with_object(self.new) do |(name, value), result| match = name.match(/^(?:HTTP_)?([A-Z0-9_]+)$/) result[match[1]] = value if match end end |