Module: Slimmer::Headers
- Defined in:
- lib/slimmer/headers.rb
Constant Summary collapse
- InvalidHeader =
Class.new(RuntimeError)
- SLIMMER_HEADER_MAPPING =
{ section: "Section", need_id: "Need-ID", format: "Format", proposition: "Proposition", result_count: "Result-Count", template: "Template", skip: "Skip", }
Instance Method Summary collapse
Instance Method Details
#set_slimmer_headers(hash) ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/slimmer/headers.rb', line 15 def set_slimmer_headers(hash) raise InvalidHeader if (hash.keys - SLIMMER_HEADER_MAPPING.keys).any? SLIMMER_HEADER_MAPPING.each do |hash_key, header_suffix| value = hash[hash_key] headers["X-Slimmer-#{header_suffix}"] = value.to_s if value end end |