Class: DMark::Parser::ElementNode
- Inherits:
-
Object
- Object
- DMark::Parser::ElementNode
- Defined in:
- lib/d-mark/parser.rb
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
-
#children ⇒ Object
readonly
Returns the value of attribute children.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(name, attributes, children) ⇒ ElementNode
constructor
A new instance of ElementNode.
- #inspect ⇒ Object
Constructor Details
#initialize(name, attributes, children) ⇒ ElementNode
Returns a new instance of ElementNode.
21 22 23 24 25 |
# File 'lib/d-mark/parser.rb', line 21 def initialize(name, attributes, children) @name = name @attributes = attributes @children = children end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
18 19 20 |
# File 'lib/d-mark/parser.rb', line 18 def attributes @attributes end |
#children ⇒ Object (readonly)
Returns the value of attribute children.
19 20 21 |
# File 'lib/d-mark/parser.rb', line 19 def children @children end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
17 18 19 |
# File 'lib/d-mark/parser.rb', line 17 def name @name end |
Instance Method Details
#==(other) ⇒ Object
39 40 41 42 43 44 45 46 47 48 |
# File 'lib/d-mark/parser.rb', line 39 def ==(other) case other when ElementNode @name == other.name && @children == other.children && @attributes == other.attributes else false end end |
#inspect ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/d-mark/parser.rb', line 27 def inspect io = '' io << 'Element(' << @name << ', ' if @attributes.any? io << @attributes.inspect io << ', ' end io << @children.inspect io << ')' io end |