Class: Dox::Formatters::Json
Instance Method Summary collapse
Methods inherited from Base
Constructor Details
This class inherits a constructor from Dox::Formatters::Base
Instance Method Details
#format ⇒ Object
4 5 6 7 8 9 10 11 |
# File 'lib/dox/formatters/json.rb', line 4 def format # in cases where the body isn't valid JSON # and the headers specify the Content-Type is application/json # an error should be raised return '' if body.nil? || body.length < 2 JSON.pretty_generate(JSON.parse(body)) end |