Class: Castle::Headers::Extract

Inherits:
Object
  • Object
show all
Defined in:
lib/castle/headers/extract.rb

Overview

used for extraction of cookies and headers from the request

Instance Method Summary collapse

Constructor Details

#initialize(headers, config = nil) ⇒ Extract

Returns a new instance of Extract.

Parameters:



17
18
19
20
21
# File 'lib/castle/headers/extract.rb', line 17

def initialize(headers, config = nil)
  @headers = headers
  @config = config || Castle.config
  @no_allowlist = @config.allowlisted.empty?
end

Instance Method Details

#callHash

Serialize HTTP headers

Returns:

  • (Hash)


25
26
27
28
29
# File 'lib/castle/headers/extract.rb', line 25

def call
  @headers.each_with_object({}) do |(name, value), acc|
    acc[name] = header_value(name, value)
  end
end