Class: HaveAPI::OutputFormatters::Json

Inherits:
BaseFormatter show all
Defined in:
lib/haveapi/output_formatters/json.rb

Instance Method Summary collapse

Methods inherited from BaseFormatter

#content_type, handle, handle?

Instance Method Details

#format(response) ⇒ Object



7
8
9
10
11
12
13
14
# File 'lib/haveapi/output_formatters/json.rb', line 7

def format(response)
  if ENV['RACK_ENV'] == 'development'
    JSON.pretty_generate(response)

  else
    JSON.generate(response)
  end
end