Class: Metanorma::Mirror::Model::Mark

Inherits:
Lutaml::Model::Serializable
  • Object
show all
Defined in:
lib/metanorma/mirror/model/mark.rb

Instance Method Summary collapse

Constructor Details

#initialize(type: nil, attrs: {}) ⇒ Mark

Returns a new instance of Mark.



15
16
17
18
# File 'lib/metanorma/mirror/model/mark.rb', line 15

def initialize(type: nil, attrs: {}, **)
  # wire keys are strings; handlers build attrs with symbol keys
  super(type: type, attrs: (attrs || {}).transform_keys(&:to_s), **)
end

Instance Method Details

#[](key) ⇒ Object



20
21
22
# File 'lib/metanorma/mirror/model/mark.rb', line 20

def [](key)
  attrs[key.to_s]
end

#[]=(key, value) ⇒ Object



24
25
26
# File 'lib/metanorma/mirror/model/mark.rb', line 24

def []=(key, value)
  attrs[key.to_s] = value
end

#fetch(key, default = nil) ⇒ Object



33
34
35
# File 'lib/metanorma/mirror/model/mark.rb', line 33

def fetch(key, default = nil, &)
  attrs.fetch(key.to_s, default, &)
end

#set_attr(key, value) ⇒ Object



28
29
30
31
# File 'lib/metanorma/mirror/model/mark.rb', line 28

def set_attr(key, value)
  attrs[key.to_s] = value
  self
end