Sha256: ed3e5aff8411a8e162dd8a3b76a3bf1c04222267751a70e6b12e10a063e7ea02

Contents?: true

Size: 587 Bytes

Versions: 16

Compression:

Stored size: 587 Bytes

Contents

module Nucleon
module Translator
class JSON < Nucleon.plugin_class(:nucleon, :translator)
   
  #-----------------------------------------------------------------------------
  # Translator operations
   
  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
  
  #---
  
  def generate(properties)
    return super do
      Util::Data.to_json(Util::Data.string_map(properties), get(:pretty, true))
    end
  end
end
end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
nucleon-0.2.16 lib/nucleon/translator/JSON.rb
nucleon-0.2.15 lib/nucleon/translator/JSON.rb
nucleon-0.2.14 lib/nucleon/translator/JSON.rb
nucleon-0.2.13 lib/nucleon/translator/JSON.rb
nucleon-0.2.12 lib/nucleon/translator/JSON.rb
nucleon-0.2.11 lib/nucleon/translator/JSON.rb
nucleon-0.2.10 lib/nucleon/translator/JSON.rb
nucleon-0.2.9 lib/nucleon/translator/JSON.rb
nucleon-0.2.8 lib/nucleon/translator/JSON.rb
nucleon-0.2.7 lib/nucleon/translator/JSON.rb
nucleon-0.2.6 lib/nucleon/translator/JSON.rb
nucleon-0.2.5 lib/nucleon/translator/JSON.rb
nucleon-0.2.4 lib/nucleon/translator/JSON.rb
nucleon-0.2.3 lib/nucleon/translator/JSON.rb
nucleon-0.2.2 lib/nucleon/translator/JSON.rb
nucleon-0.2.1 lib/nucleon/translator/JSON.rb