Module: Sfn::Utils::JSON
- Included in:
- Command::Import, Sfn::Utils, StackExporter
- Defined in:
- lib/sfn/utils/json.rb
Overview
JSON helper methods
Instance Method Summary collapse
-
#_format_json(thing) ⇒ String
(also: #format_json)
Format object into pretty JSON.
-
#_from_json(thing) ⇒ Object
(also: #load_json)
Load JSON data.
-
#_to_json(thing) ⇒ String
(also: #dump_json)
Convert to JSON.
Instance Method Details
#_format_json(thing) ⇒ String Also known as: format_json
Format object into pretty JSON
33 34 35 36 |
# File 'lib/sfn/utils/json.rb', line 33 def _format_json(thing) thing = _from_json(thing) if thing.is_a?(String) MultiJson.dump(thing, :pretty => true) end |
#_from_json(thing) ⇒ Object Also known as: load_json
Load JSON data
23 24 25 |
# File 'lib/sfn/utils/json.rb', line 23 def _from_json(thing) MultiJson.load(thing) end |
#_to_json(thing) ⇒ String Also known as: dump_json
Convert to JSON
13 14 15 |
# File 'lib/sfn/utils/json.rb', line 13 def _to_json(thing) MultiJson.dump(thing) end |