Class: FDK::InHeaders
- Inherits:
-
Object
- Object
- FDK::InHeaders
- Defined in:
- lib/fdk/context.rb
Overview
Represents inbound HTTP headers
Direct Known Subclasses
Instance Method Summary collapse
- #[](key) ⇒ Object
- #each(&block) ⇒ Object
- #header_key(key) ⇒ Object
-
#initialize(headers, key_fn) ⇒ InHeaders
constructor
A new instance of InHeaders.
Constructor Details
#initialize(headers, key_fn) ⇒ InHeaders
Returns a new instance of InHeaders.
31 32 33 34 |
# File 'lib/fdk/context.rb', line 31 def initialize(headers, key_fn) @headers = headers @key_fn = key_fn end |
Instance Method Details
#[](key) ⇒ Object
41 42 43 44 |
# File 'lib/fdk/context.rb', line 41 def [](key) h = @headers[header_key(key)] h[0] unless h.nil? end |
#each(&block) ⇒ Object
46 47 48 |
# File 'lib/fdk/context.rb', line 46 def each(&block) @headers.each(&block) end |
#header_key(key) ⇒ Object
36 37 38 39 |
# File 'lib/fdk/context.rb', line 36 def header_key(key) key = @key_fn.call(key) if @key_fn key.downcase end |