Class: DMark::Nodes::ElementNode
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Attributes inherited from Node
Instance Method Summary collapse
-
#initialize(name:, attributes:) ⇒ ElementNode
constructor
A new instance of ElementNode.
- #inspect(indent = 0) ⇒ Object
Constructor Details
#initialize(name:, attributes:) ⇒ ElementNode
Returns a new instance of ElementNode.
55 56 57 58 59 |
# File 'lib/dmark/nodes.rb', line 55 def initialize(name:, attributes:) super() @name = name @attributes = attributes end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
53 54 55 |
# File 'lib/dmark/nodes.rb', line 53 def attributes @attributes end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
52 53 54 |
# File 'lib/dmark/nodes.rb', line 52 def name @name end |
Instance Method Details
#inspect(indent = 0) ⇒ Object
61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/dmark/nodes.rb', line 61 def inspect(indent = 0) io = '' io << ' ' * indent io << 'Element(' io << @name io << ',' << @attributes.inspect unless @attributes.empty? io << "\n" if children.any? children.each { |c| io << c.inspect(indent + 1) } io << ' ' * indent if children.any? io << ')' io << "\n" io end |