Class: Lutaml::Model::KeyValueDocument

Inherits:
Object
  • Object
show all
Defined in:
lib/lutaml/model/key_value_document.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#attributesObject (readonly)

Returns the value of attribute attributes.



4
5
6
# File 'lib/lutaml/model/key_value_document.rb', line 4

def attributes
  @attributes
end

#registerObject (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

Returns:

  • (Boolean)


19
20
21
# File 'lib/lutaml/model/key_value_document.rb', line 19

def key?(key)
  @attributes.key?(key)
end

#to_hObject



23
24
25
# File 'lib/lutaml/model/key_value_document.rb', line 23

def to_h
  @attributes
end