Module: Prettify::Prettifier
- Included in:
- Command
- Defined in:
- lib/prettify.rb
Instance Method Summary collapse
Instance Method Details
#prettify(json) ⇒ Object
13 14 15 16 |
# File 'lib/prettify.rb', line 13 def prettify(json) json_map = json.class == String ? JSON.parse(json) : json JSON.pretty_generate(json_map).gsub(/\[\n+\s*\]/, '[]') end |