class Locked::Extractors::Headers

used for extraction of cookies and headers from the request

Public Class Methods

new(request) click to toggle source
# File lib/locked/extractors/headers.rb, line 7
def initialize(request)
  @request = request
  @request_env = @request.env
  @formatter = HeaderFormatter.new
end

Public Instance Methods

call() click to toggle source

Serialize HTTP headers

# File lib/locked/extractors/headers.rb, line 14
def call
  @request_env.keys.each_with_object({}) do |header, acc|
    name = @formatter.call(header)
    next unless Locked.config.whitelisted.include?(name)
    next if Locked.config.blacklisted.include?(name)
    acc[name] = @request_env[header]
  end
end