Method: Waitress::REST#encode_format
- Defined in:
- lib/waitress/restful/restbuilder.rb
#encode_format(content_hash, request, response, type) ⇒ Object
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/waitress/restful/restbuilder.rb', line 55 def encode_format content_hash, request, response, type ret = "" if type == :json if request.get_query.include? "pretty" ret = JSON.pretty_generate(content_hash) else ret = JSON.generate(content_hash) end elsif type == :scon ret = SCON.generate!(content_hash) elsif type == :yaml || type == :yml ret = content_hash.to_yaml end ret end |