Class: SetConstantNode

Inherits:
Struct
  • Object
show all
Defined in:
lib/nodes.rb,
lib/interpreter.rb

Overview

Setting the value of a constant.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#nameObject

Returns the value of attribute name

Returns:

  • (Object)

    the current value of name



43
44
45
# File 'lib/nodes.rb', line 43

def name
  @name
end

#valueObject

Returns the value of attribute value

Returns:

  • (Object)

    the current value of value



43
44
45
# File 'lib/nodes.rb', line 43

def value
  @value
end

Instance Method Details

#eval(context) ⇒ Object



92
93
94
# File 'lib/interpreter.rb', line 92

def eval(context)
  context[name] = value.eval(context)
end