Class: Hotdog::Formatters::Json
- Inherits:
-
BaseFormatter
- Object
- BaseFormatter
- Hotdog::Formatters::Json
- Defined in:
- lib/hotdog/formatters/json.rb
Instance Method Summary collapse
Instance Method Details
#format(result, options = {}) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/hotdog/formatters/json.rb', line 8 def format(result, ={}) result = prepare(result) if [:headers] and [:fields] result.map! do |record| Hash[[:fields].zip(record)] end JSON.pretty_generate(result) + newline else JSON.pretty_generate(result) + newline end end |