Method: Confuscript::Nodes::AssignmentNode#evaluate
- Defined in:
- lib/confuscript/nodes/assignment_node.rb
#evaluate(context) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/confuscript/nodes/assignment_node.rb', line 4 def evaluate(context) # Store the value in the context using the variable's name as the key. # If the value is an arithmetic node, evaluate it first. # Otherwise, just evaluate the value. if respond_to?(:arithmetic) context[variable.text_value] = arithmetic.evaluate(context) elsif respond_to?(:value) context[variable.text_value] = value.evaluate(context) else respond_to?(:print_call) context[variable.text_value] = print_call.evaluate(context) end context[variable.text_value] end |