Class: Nucleon::Translator::JSON

Inherits:
Object
  • Object
show all
Defined in:
lib/nucleon/translator/JSON.rb

Instance Method Summary collapse

Instance Method Details

#generate(properties) ⇒ Object




20
21
22
23
24
# File 'lib/nucleon/translator/JSON.rb', line 20

def generate(properties)
  return super do
    Util::Data.to_json(Util::Data.string_map(properties), get(:pretty, true))
  end
end

#parse(json_text) ⇒ Object


Translator operations



9
10
11
12
13
14
15
16
# File 'lib/nucleon/translator/JSON.rb', line 9

def parse(json_text)
  return super do |properties|
    if json_text && ! json_text.empty?
      properties = Util::Data.symbol_map(Util::Data.parse_json(json_text))
    end
    properties
  end
end