Class: Lutaml::Model::Json::StandardAdapter

Inherits:
Document show all
Defined in:
lib/lutaml/model/json/standard_adapter.rb

Constant Summary collapse

FORMAT_SYMBOL =
:json

Instance Attribute Summary

Attributes inherited from KeyValueDocument

#attributes, #register

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from KeyValueDocument

#[], #[]=, #initialize, #key?, #to_h

Constructor Details

This class inherits a constructor from Lutaml::Model::KeyValueDocument

Class Method Details

.parse(json, _options = {}) ⇒ Object



10
11
12
# File 'lib/lutaml/model/json/standard_adapter.rb', line 10

def self.parse(json, _options = {})
  JSON.parse(json, create_additions: false)
end

Instance Method Details

#to_json(*args) ⇒ Object



14
15
16
17
18
19
20
21
# File 'lib/lutaml/model/json/standard_adapter.rb', line 14

def to_json(*args)
  options = args.first || {}
  if options[:pretty]
    JSON.pretty_generate(@attributes, *args)
  else
    JSON.generate(@attributes, *args)
  end
end