Class: Salestation::Web::Extractors::HeadersExtractor
- Inherits:
-
Object
- Object
- Salestation::Web::Extractors::HeadersExtractor
- Includes:
- Deterministic
- Defined in:
- lib/salestation/web/extractors.rb
Class Method Summary collapse
Class Method Details
.[](headers) ⇒ Object
167 168 169 170 171 172 173 174 175 176 177 178 179 |
# File 'lib/salestation/web/extractors.rb', line 167 def self.[](headers) InputExtractor.new do |rack_request| input = headers.map do |header, key| value = rack_request.env["HTTP_#{header.upcase.tr('-', '_')}"] value ||= rack_request.env["#{header.upcase.tr('-', '_')}"] next if value.nil? [key, value] end.compact.to_h Result::Success(input) end end |