Class: Yap::Shell::Parser::Nodes::PipelineNode

Inherits:
Object
  • Object
show all
Includes:
Visitor
Defined in:
lib/yap/shell/parser/nodes.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Visitor

#accept

Constructor Details

#initialize(head, tail) ⇒ PipelineNode

Returns a new instance of PipelineNode.



210
211
212
213
# File 'lib/yap/shell/parser/nodes.rb', line 210

def initialize(head, tail)
  @head = head
  @tail = tail
end

Instance Attribute Details

#headObject (readonly)

Returns the value of attribute head.



208
209
210
# File 'lib/yap/shell/parser/nodes.rb', line 208

def head
  @head
end

#tailObject (readonly)

Returns the value of attribute tail.



208
209
210
# File 'lib/yap/shell/parser/nodes.rb', line 208

def tail
  @tail
end

Instance Method Details

#inspectObject



223
224
225
# File 'lib/yap/shell/parser/nodes.rb', line 223

def inspect
  to_s
end

#to_s(indent: 0) ⇒ Object



215
216
217
218
219
220
221
# File 'lib/yap/shell/parser/nodes.rb', line 215

def to_s(indent:0)
  "    |  \#{' ' * indent}PipelineNode(\n    |  \#{' ' * indent}  \#{@head.to_s},\n    |  \#{' ' * indent}  \#{@tail.to_s})\n  EOT\nend\n".gsub(/^\s+\|/, '')