Class: Rubasteme::AST::CondClauseNode

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

Instance Method Summary collapse

Methods inherited from HoldingSequenceBaseNode

#sequence, #sequence=

Methods inherited from ListNode

#elements, #empty?, #first, #rest

Methods inherited from BranchNode

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

Methods inherited from Node

#to_a, #to_s, #type

Constructor Details

#initialize(_ = nil) ⇒ CondClauseNode

Returns a new instance of CondClauseNode.



307
308
309
310
311
312
# File 'lib/rubasteme/ast/branch_node.rb', line 307

def initialize(_ = nil)
  # type 1: @nodes = [<test>, <sequence>]
  # type 2: @nodes = [<test>]
  #   - <sequence> is empty
  super(2, 1, _)
end

Instance Method Details

#testObject



314
315
316
# File 'lib/rubasteme/ast/branch_node.rb', line 314

def test
  @nodes[0]
end

#test=(node) ⇒ Object



318
319
320
# File 'lib/rubasteme/ast/branch_node.rb', line 318

def test=(node)
  @nodes[0] = node
end