Class: Lutaml::Model::Xml::Element
- Inherits:
-
Object
- Object
- Lutaml::Model::Xml::Element
- Defined in:
- lib/lutaml/model/xml/element.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
- #element_tag ⇒ Object
- #eql?(other) ⇒ Boolean (also: #==)
-
#initialize(type, name) ⇒ Element
constructor
A new instance of Element.
- #text? ⇒ Boolean
Constructor Details
#initialize(type, name) ⇒ Element
Returns a new instance of Element.
7 8 9 10 |
# File 'lib/lutaml/model/xml/element.rb', line 7 def initialize(type, name) @type = type @name = name end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
5 6 7 |
# File 'lib/lutaml/model/xml/element.rb', line 5 def name @name end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
5 6 7 |
# File 'lib/lutaml/model/xml/element.rb', line 5 def type @type end |
Instance Method Details
#element_tag ⇒ Object
16 17 18 |
# File 'lib/lutaml/model/xml/element.rb', line 16 def element_tag @name unless text? end |
#eql?(other) ⇒ Boolean Also known as: ==
20 21 22 23 24 25 26 |
# File 'lib/lutaml/model/xml/element.rb', line 20 def eql?(other) return false unless other.is_a?(self.class) instance_variables.all? do |var| instance_variable_get(var) == other.instance_variable_get(var) end end |
#text? ⇒ Boolean
12 13 14 |
# File 'lib/lutaml/model/xml/element.rb', line 12 def text? @type == "Text" && @name != "#cdata-section" end |