Class: ElseifNode

Inherits:
Node
  • Object
show all
Defined in:
lib/nodes/stmtnodes.rb

Instance Attribute Summary collapse

Attributes inherited from Node

#value

Instance Method Summary collapse

Constructor Details

#initialize(argument, node) ⇒ ElseifNode

Returns a new instance of ElseifNode.



186
187
188
# File 'lib/nodes/stmtnodes.rb', line 186

def initialize(argument, node)
  @argument, @node = argument, node
end

Instance Attribute Details

#argumentObject

Returns the value of attribute argument.



184
185
186
# File 'lib/nodes/stmtnodes.rb', line 184

def argument
  @argument
end

Instance Method Details

#create_tree_entryObject



194
195
196
197
198
# File 'lib/nodes/stmtnodes.rb', line 194

def create_tree_entry
  result = set_up_scope_header
  result += "Elseif statement is used. #{@argument}"
  TREE_ARRAY << result unless TREE_ARRAY[-1] == result
end

#evaluateObject



200
201
202
203
204
# File 'lib/nodes/stmtnodes.rb', line 200

def evaluate
  @value = @node.evaluate
  create_tree_entry if PRINT_TREE_FLAG
  @value
end

#to_sObject



190
191
192
# File 'lib/nodes/stmtnodes.rb', line 190

def to_s
  'Else'
end