Class: DMark::Nodes::TextNode
Instance Attribute Summary collapse
-
#text ⇒ Object
readonly
Returns the value of attribute text.
Attributes inherited from Node
Instance Method Summary collapse
-
#initialize(text:) ⇒ TextNode
constructor
A new instance of TextNode.
- #inspect(indent = 0) ⇒ Object
Constructor Details
#initialize(text:) ⇒ TextNode
Returns a new instance of TextNode.
32 33 34 35 |
# File 'lib/dmark/nodes.rb', line 32 def initialize(text:) super() @text = text end |
Instance Attribute Details
#text ⇒ Object (readonly)
Returns the value of attribute text.
30 31 32 |
# File 'lib/dmark/nodes.rb', line 30 def text @text end |
Instance Method Details
#inspect(indent = 0) ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/dmark/nodes.rb', line 37 def inspect(indent = 0) io = '' io << ' ' * indent io << 'Text(' io << @text.inspect io << "\n" if children.any? children.each { |c| io << c.inspect(indent + 1) } io << ' ' * indent if children.any? io << ')' io << "\n" io end |