Class: ChupaText::Formatters::JSON

Inherits:
Hash
  • Object
show all
Defined in:
lib/chupa-text/formatters/json.rb

Instance Method Summary collapse

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