Class: Hotdog::Formatters::Json

Inherits:
BaseFormatter show all
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
# File 'lib/hotdog/formatters/json.rb', line 8

def format(result, options={})
  result = result.dup
  if options[:headers] and options[:fields]
    result.unshift(options[:fields])
  end
  JSON.pretty_generate(result) + "\n"
end