Class: PrintNode

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

Overview

Built-in Functions

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value) ⇒ PrintNode

Returns a new instance of PrintNode.



275
276
277
# File 'lib/nodes/stmtnodes.rb', line 275

def initialize(value)
  @value = value
end

Instance Attribute Details

#valueObject

Returns the value of attribute value.



273
274
275
# File 'lib/nodes/stmtnodes.rb', line 273

def value
  @value
end

Instance Method Details

#create_tree_entryObject



279
280
281
282
283
# File 'lib/nodes/stmtnodes.rb', line 279

def create_tree_entry
  result = set_up_scope_header
  result += "Printed #{@value}."
  TREE_ARRAY << result unless TREE_ARRAY[-1] == result
end

#evaluateObject



285
286
287
288
289
290
291
292
293
294
# File 'lib/nodes/stmtnodes.rb', line 285

def evaluate
  if @value.evaluate.is_a?(ArrayNode)
    print "Array #{@value.name}: "     unless TEST_UNIT_ACTIVE
    puts @value.evaluate               unless TEST_UNIT_ACTIVE
  else
    puts @value.evaluate               unless TEST_UNIT_ACTIVE
  end
  create_tree_entry if PRINT_TREE_FLAG
  self.class
end