Class: Rubasteme::AST::ListNode

Inherits:
BranchNode show all
Defined in:
lib/rubasteme/ast/branch_node.rb

Instance Method Summary collapse

Methods inherited from BranchNode

#<<, #[], #[]=, #each, #size, #to_a

Methods inherited from Node

#to_a, #to_s, #type

Constructor Details

#initialize(initial_size = 0, _ = nil) ⇒ ListNode

Returns a new instance of ListNode.



58
59
60
# File 'lib/rubasteme/ast/branch_node.rb', line 58

def initialize(initial_size = 0, _ = nil)
  super(initial_size)
end

Instance Method Details

#elementsObject



74
75
76
# File 'lib/rubasteme/ast/branch_node.rb', line 74

def elements
  @nodes
end

#empty?Boolean

Returns:

  • (Boolean)


62
63
64
# File 'lib/rubasteme/ast/branch_node.rb', line 62

def empty?
  @nodes.empty?
end

#firstObject



66
67
68
# File 'lib/rubasteme/ast/branch_node.rb', line 66

def first
  @nodes[0]
end

#restObject



70
71
72
# File 'lib/rubasteme/ast/branch_node.rb', line 70

def rest
  @nodes[1..-1]
end