Class: Simulator::Sandbox

Inherits:
Object
  • Object
show all
Defined in:
lib/simulator/sandbox.rb

Instance Method Summary collapse

Constructor Details

#initialize(context, periods = []) ⇒ Sandbox

Returns a new instance of Sandbox.



3
4
5
6
# File 'lib/simulator/sandbox.rb', line 3

def initialize(context, periods = [])
  @context = context
  @periods = periods
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_name, *args, &block) ⇒ Object (private)



25
26
27
28
29
# File 'lib/simulator/sandbox.rb', line 25

def method_missing(method_name, *args, &block)
  var = @context.get method_name.to_sym
  return var.value unless var.nil?
  super(method_name, *args, &block)
end