Module: Sinatra::JSONHelpers

Defined in:
lib/fanforce/app_factory/config/helpers/json.rb

Instance Method Summary collapse

Instance Method Details

#json(*args) ⇒ Object Also known as: JSON



4
5
6
7
8
# File 'lib/fanforce/app_factory/config/helpers/json.rb', line 4

def json(*args)
  args[0] = {} if args.size == 0
  content_type (Rack.const_defined?('JSONR') and Rack::JSONR.is_jsonp_request?(request)) ? 'application/javascript' : :json
  MultiJson.dump args[0], :pretty => settings.respond_to?(:json_pretty) && settings.json_pretty
end