Class: Lutaml::JsonLd::Adapter
- Inherits:
-
KeyValue::Document
- Object
- KeyValue::Document
- Lutaml::JsonLd::Adapter
- Defined in:
- lib/lutaml/jsonld/adapter.rb
Instance Attribute Summary
Attributes inherited from KeyValue::Document
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from KeyValue::Document
#[], #[]=, #initialize, #key?, #to_h
Constructor Details
This class inherits a constructor from Lutaml::KeyValue::Document
Class Method Details
.parse(jsonld_string, _options = {}) ⇒ Object
9 10 11 |
# File 'lib/lutaml/jsonld/adapter.rb', line 9 def self.parse(jsonld_string, = {}) JSON.parse(jsonld_string) end |
Instance Method Details
#to_jsonld(*args) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/lutaml/jsonld/adapter.rb', line 13 def to_jsonld(*args) data = @attributes unless Lutaml::Json::GeneratorOptions.(args.first) return JSON.generate(data, args.first) end = args.first || {} = Lutaml::Json::GeneratorOptions.filter() if [:pretty] JSON.pretty_generate(data, ) else JSON.generate(data, ) end end |