Class: ConciseErrors::Formatter
- Inherits:
-
Object
- Object
- ConciseErrors::Formatter
- Defined in:
- lib/concise_errors/formatter.rb
Overview
Builds the compact error payload for browser responses.
Constant Summary collapse
- OMITTED_SUFFIX =
"... %<count>d more lines omitted"
Instance Method Summary collapse
- #body ⇒ Object
- #content_type ⇒ Object
-
#initialize(wrapper, request, configuration) ⇒ Formatter
constructor
A new instance of Formatter.
Constructor Details
#initialize(wrapper, request, configuration) ⇒ Formatter
Returns a new instance of Formatter.
12 13 14 15 16 |
# File 'lib/concise_errors/formatter.rb', line 12 def initialize(wrapper, request, configuration) @wrapper = wrapper @request = request @configuration = configuration end |
Instance Method Details
#body ⇒ Object
18 19 20 |
# File 'lib/concise_errors/formatter.rb', line 18 def body response_format == :html ? html_payload : text_payload end |
#content_type ⇒ Object
22 23 24 |
# File 'lib/concise_errors/formatter.rb', line 22 def content_type response_format == :html ? "text/html" : "text/plain" end |