Module: JsonRender
- Defined in:
- lib/angus/renders/json_render.rb
Class Method Summary collapse
Class Method Details
.convert(json) ⇒ Object
3 4 5 6 7 8 9 |
# File 'lib/angus/renders/json_render.rb', line 3 def self.convert(json) if json.is_a?(String) json else JSON(json, :ascii_only => true) end end |
.render(response, json) ⇒ Object
11 12 13 14 15 |
# File 'lib/angus/renders/json_render.rb', line 11 def self.render(response, json) response['Content-Type'] = 'application/json' response.write(convert(json)) end |