Class: Metanorma::Mirror::Model::Node

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

Direct Known Subclasses

Container, Leaf

Instance Method Summary collapse

Constructor Details

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

**options carries framework construction kwargs (e.g. lutaml_register) through to the base serializer



17
18
19
20
21
# File 'lib/metanorma/mirror/model/node.rb', line 17

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

Instance Method Details

#accept_rewriter(_rewriter) ⇒ Object

Raises:

  • (NotImplementedError)


35
36
37
38
# File 'lib/metanorma/mirror/model/node.rb', line 35

def accept_rewriter(_rewriter)
  raise NotImplementedError,
        "#{self.class}#accept_rewriter not implemented"
end

#container? ⇒ Boolean

Returns:

  • (Boolean)


27
28
29
# File 'lib/metanorma/mirror/model/node.rb', line 27

def container?
  false
end

#leaf? ⇒ Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/metanorma/mirror/model/node.rb', line 23

def leaf?
  false
end

#text_content ⇒ Object



31
32
33
# File 'lib/metanorma/mirror/model/node.rb', line 31

def text_content
  ""
end