Class: Lutaml::Model::KeyValueDocument
- Inherits:
-
Object
- Object
- Lutaml::Model::KeyValueDocument
- Defined in:
- lib/lutaml/model/key_value_document.rb
Direct Known Subclasses
HashAdapter::Document, Json::Document, Toml::Document, Yaml::Document
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
-
#register ⇒ Object
readonly
Returns the value of attribute register.
Instance Method Summary collapse
- #[](key) ⇒ Object
- #[]=(key, value) ⇒ Object
-
#initialize(attributes = {}, register: nil) ⇒ KeyValueDocument
constructor
A new instance of KeyValueDocument.
- #key?(key) ⇒ Boolean
- #to_h ⇒ Object
Constructor Details
#initialize(attributes = {}, register: nil) ⇒ KeyValueDocument
Returns a new instance of KeyValueDocument.
6 7 8 9 |
# File 'lib/lutaml/model/key_value_document.rb', line 6 def initialize(attributes = {}, register: nil) @attributes = attributes @register = register || Lutaml::Model::Config.default_register end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
4 5 6 |
# File 'lib/lutaml/model/key_value_document.rb', line 4 def attributes @attributes end |
#register ⇒ Object (readonly)
Returns the value of attribute register.
4 5 6 |
# File 'lib/lutaml/model/key_value_document.rb', line 4 def register @register end |
Instance Method Details
#[](key) ⇒ Object
11 12 13 |
# File 'lib/lutaml/model/key_value_document.rb', line 11 def [](key) @attributes[key] end |
#[]=(key, value) ⇒ Object
15 16 17 |
# File 'lib/lutaml/model/key_value_document.rb', line 15 def []=(key, value) @attributes[key] = value end |
#key?(key) ⇒ Boolean
19 20 21 |
# File 'lib/lutaml/model/key_value_document.rb', line 19 def key?(key) @attributes.key?(key) end |
#to_h ⇒ Object
23 24 25 |
# File 'lib/lutaml/model/key_value_document.rb', line 23 def to_h @attributes end |