Class: Lecter::FormatterHeaders
- Inherits:
-
Object
- Object
- Lecter::FormatterHeaders
- Defined in:
- lib/lecter/formatter_headers.rb
Constant Summary collapse
- WRONG_HEADERS_MSG =
'Wrong headers'
Instance Attribute Summary collapse
-
#error_message ⇒ Object
readonly
Returns the value of attribute error_message.
-
#result ⇒ Object
readonly
Returns the value of attribute result.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(headers) ⇒ FormatterHeaders
constructor
A new instance of FormatterHeaders.
Constructor Details
#initialize(headers) ⇒ FormatterHeaders
Returns a new instance of FormatterHeaders.
8 9 10 |
# File 'lib/lecter/formatter_headers.rb', line 8 def initialize(headers) @dirty_headers = headers end |
Instance Attribute Details
#error_message ⇒ Object (readonly)
Returns the value of attribute error_message.
6 7 8 |
# File 'lib/lecter/formatter_headers.rb', line 6 def @error_message end |
#result ⇒ Object (readonly)
Returns the value of attribute result.
6 7 8 |
# File 'lib/lecter/formatter_headers.rb', line 6 def result @result end |
Instance Method Details
#call ⇒ Object
12 13 14 15 16 17 18 19 20 |
# File 'lib/lecter/formatter_headers.rb', line 12 def call @result = dirty_headers .split(',') .map { |header_with_value| header_with_value.split('=') } .to_h rescue StandardError @error_message = WRONG_HEADERS_MSG false end |