Method: Q_Environment#initialize

Defined in:
lib/q-language/environment.rb

#initialize(variables = {}, *implicit, object, options) ⇒ Q_Environment

Returns a new instance of Q_Environment.



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/q-language/environment.rb', line 7

def initialize (variables = {}, *implicit, object, options)
  @successful_methods = Hash.new {|h,k| h[k] = 0 }
  @failed_methods = Hash.new {|h,k| h[k] = 0 }
  @discarded_objects = Hash.new {|h,k| h[k] = 0 }
  @nodes_evaluated = Hash.new {|h,k| h[k] = 0 }
  
  @max_nodes = options[0]
  @max_method_nodes = options[1]
  
  @max_array_length = options[2]
  @max_hash_length = options[3]
  @max_string_length = options[4]
  
  @variables = variables.to_hash
  @implicit = implicit
  @frame_stack = [object]
  
  @scope = { queue: [], method_stack: [], unassigned_variables: [], prev: nil }
  @method_results = []
end