Class: Lutaml::Model::Xml::Element
- Inherits:
-
Object
- Object
- Lutaml::Model::Xml::Element
show all
- Defined in:
- lib/lutaml/model/xml/element.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(type, name) ⇒ 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
Returns the value of attribute name.
5
6
7
|
# File 'lib/lutaml/model/xml/element.rb', line 5
def name
@name
end
|
#type ⇒ Object
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
|