Class: Lutaml::YamlLd::Adapter
- Inherits:
-
KeyValue::Document
- Object
- KeyValue::Document
- Lutaml::YamlLd::Adapter
- Defined in:
- lib/lutaml/yamlld/adapter.rb
Constant Summary collapse
- PERMITTED_CLASSES =
Lutaml::Yaml::Adapter::StandardAdapter::PERMITTED_CLASSES
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(yaml_string, _options = {}) ⇒ Object
10 11 12 |
# File 'lib/lutaml/yamlld/adapter.rb', line 10 def self.parse(yaml_string, = {}) YAML.safe_load(yaml_string, permitted_classes: PERMITTED_CLASSES) end |
Instance Method Details
#to_yamlld(options = {}) ⇒ Object
14 15 16 17 18 19 20 21 22 |
# File 'lib/lutaml/yamlld/adapter.rb', line 14 def to_yamlld( = {}) attributes_to_serialize = if @attributes.is_a?(Lutaml::KeyValue::DataModel::Element) @attributes.to_hash["__root__"] else @attributes end YAML.dump(attributes_to_serialize, ) end |