Class: TestInterpreter::ExecutionContext

Inherits:
BlocklyInterpreter::ExecutionContext show all
Defined in:
lib/blockly_interpreter/test_helper.rb

Instance Attribute Summary collapse

Attributes inherited from BlocklyInterpreter::ExecutionContext

#debug_messages, #early_return_value, #interpreter, #terminated

Instance Method Summary collapse

Methods inherited from BlocklyInterpreter::ExecutionContext

#add_debug_message, #early_return!, #execute, #execute_procedure, #get_variable, #set_variable, #set_variables, #value_for_procedure

Constructor Details

#initialize(interpreter, variables = {}) ⇒ ExecutionContext

Returns a new instance of ExecutionContext.



53
54
55
56
57
# File 'lib/blockly_interpreter/test_helper.rb', line 53

def initialize(interpreter, variables = {})
  super(interpreter)
  set_variables variables
  @content = ""
end

Instance Attribute Details

#contentObject (readonly)

Returns the value of attribute content.



51
52
53
# File 'lib/blockly_interpreter/test_helper.rb', line 51

def content
  @content
end

Instance Method Details

#add_content(str) ⇒ Object



59
60
61
# File 'lib/blockly_interpreter/test_helper.rb', line 59

def add_content(str)
  @content << str
end

#merge_state_from(context) ⇒ Object



63
64
65
# File 'lib/blockly_interpreter/test_helper.rb', line 63

def merge_state_from(context)
  add_content(context.content)
end