Class: Yap::Shell::Parser::Nodes::StatementsNode
- Inherits:
-
Object
- Object
- Yap::Shell::Parser::Nodes::StatementsNode
- Includes:
- Visitor
- Defined in:
- lib/yap/shell/parser/nodes.rb
Instance Attribute Summary collapse
-
#head ⇒ Object
readonly
Returns the value of attribute head.
-
#tail ⇒ Object
readonly
Returns the value of attribute tail.
Instance Method Summary collapse
-
#initialize(head, tail = nil) ⇒ StatementsNode
constructor
A new instance of StatementsNode.
- #inspect ⇒ Object
- #to_s(indent: 0) ⇒ Object
Methods included from Visitor
Constructor Details
#initialize(head, tail = nil) ⇒ StatementsNode
Returns a new instance of StatementsNode.
140 141 142 143 144 145 146 147 |
# File 'lib/yap/shell/parser/nodes.rb', line 140 def initialize(head, tail=nil) if head.is_a?(StatementsNode) && head.tail.nil? @head = head.head else @head = head end @tail = tail end |
Instance Attribute Details
#head ⇒ Object (readonly)
Returns the value of attribute head.
138 139 140 |
# File 'lib/yap/shell/parser/nodes.rb', line 138 def head @head end |
#tail ⇒ Object (readonly)
Returns the value of attribute tail.
138 139 140 |
# File 'lib/yap/shell/parser/nodes.rb', line 138 def tail @tail end |
Instance Method Details
#inspect ⇒ Object
157 158 159 |
# File 'lib/yap/shell/parser/nodes.rb', line 157 def inspect to_s end |
#to_s(indent: 0) ⇒ Object
149 150 151 152 153 154 155 |
# File 'lib/yap/shell/parser/nodes.rb', line 149 def to_s(indent:0) <<-EOT.gsub(/^\s+\|/, '') | #{' ' * indent}StatementsNode( | #{' ' * indent} #{@head.to_s}, | #{' ' * indent} #{@tail.to_s}) EOT end |