Class: Yap::Shell::Parser::Nodes::BlockNode

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, params: nil) ⇒ BlockNode

Returns a new instance of BlockNode.



291
292
293
294
295
# File 'lib/yap/shell/parser/nodes.rb', line 291

def initialize(head, tail, params: nil)
  @head = head
  @tail = tail
  @params = params ? params.value : []
end

Instance Attribute Details

#headObject

Returns the value of attribute head.



289
290
291
# File 'lib/yap/shell/parser/nodes.rb', line 289

def head
  @head
end

#paramsObject

Returns the value of attribute params.



289
290
291
# File 'lib/yap/shell/parser/nodes.rb', line 289

def params
  @params
end

#tailObject

Returns the value of attribute tail.



289
290
291
# File 'lib/yap/shell/parser/nodes.rb', line 289

def tail
  @tail
end

Instance Method Details

#inspectObject



305
306
307
# File 'lib/yap/shell/parser/nodes.rb', line 305

def inspect
  to_s
end

#to_s(indent: 0) ⇒ Object



297
298
299
300
301
302
303
# File 'lib/yap/shell/parser/nodes.rb', line 297

def to_s(indent:0)
  if @counter_reference
    "BlockNode(#{@head.inspect}, tail: #{@tail.inspect} params: #{@params.inspect})"
  else
    "BlockNode(#{@head.inspect}, tail: #{@tail.inspect} params: #{@params.inspect})"
  end
end