Class: ChupaText::Formatters::JSON
- Defined in:
- lib/chupa-text/formatters/json.rb
Instance Method Summary collapse
- #format_finish(data) ⇒ Object
-
#initialize(output) ⇒ JSON
constructor
A new instance of JSON.
Methods inherited from Hash
#format_extracted, #format_start
Constructor Details
#initialize(output) ⇒ JSON
Returns a new instance of JSON.
24 25 26 27 |
# File 'lib/chupa-text/formatters/json.rb', line 24 def initialize(output) super() @output = output end |
Instance Method Details
#format_finish(data) ⇒ Object
29 30 31 32 33 |
# File 'lib/chupa-text/formatters/json.rb', line 29 def format_finish(data) formatted = super @output << ::JSON.pretty_generate(formatted) @output << "\n" end |