Module: JsonRender

Defined in:
lib/angus/renders/json_render.rb

Class Method Summary collapse

Class Method Details

.render(response, json) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
# File 'lib/angus/renders/json_render.rb', line 3

def self.render(response, json)
  response['Content-Type'] = 'application/json'

  json = if json.is_a?(String)
           json
         else
           JSON(json, :ascii_only => true)
         end

  response.write(json)
end