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.



179
180
181
# File 'lib/nodes/stmtnodes.rb', line 179

def initialize(value)
  @value = value
end

Instance Attribute Details

#valueObject

Returns the value of attribute value.



177
178
179
# File 'lib/nodes/stmtnodes.rb', line 177

def value
  @value
end

Instance Method Details

#evaluateObject



183
184
185
186
187
188
189
190
191
192
193
194
# File 'lib/nodes/stmtnodes.rb', line 183

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