Module: Sinatra::Chicago::Responders

Defined in:
lib/chicago/responders.rb

Instance Method Summary collapse

Instance Method Details

#json_response(object) ⇒ Object

Returns a JSON response for an object. Will return an empty string if the provided object is nil.



6
7
8
9
# File 'lib/chicago/responders.rb', line 6

def json_response(object)
  content_type 'application/json'
  object ? object.to_json : ""
end