Class: ConsoleUtils::JSONOutput::DefaultFormatter
- Inherits:
-
BaseFormatter
- Object
- BaseFormatter
- ConsoleUtils::JSONOutput::DefaultFormatter
- Defined in:
- lib/console_utils/json_output/default_formatter.rb
Overview
The default formatter uses standart JSON library to output prettified JSON
Instance Method Summary collapse
-
#format(body) ⇒ Object
:nodoc:.
Methods inherited from BaseFormatter
Instance Method Details
#format(body) ⇒ Object
:nodoc:
5 6 7 8 9 10 |
# File 'lib/console_utils/json_output/default_formatter.rb', line 5 def format(body) #:nodoc: JSON.pretty_generate JSON(body), :allow_nan => true, :max_nesting => false rescue JSON::ParseError, JSON::GeneratorError error = $! raise ParseError, "#{error.class.to_s}: #{error.}" end |