Class: Configure::Sandbox

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

Overview

The sandbox can be used to catch method calls and delegates them the to passed injector.

Instance Method Summary collapse

Constructor Details

#initialize(injector) ⇒ Sandbox

Returns a new instance of Sandbox.



5
6
7
# File 'lib/configure/sandbox.rb', line 5

def initialize(injector)
  @injector = injector
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_name, *arguments, &block) ⇒ Object



9
10
11
12
13
14
15
# File 'lib/configure/sandbox.rb', line 9

def method_missing(method_name, *arguments, &block)
  if block_given?
    @injector.put_block method_name, arguments, &block
  else
    @injector.put_arguments method_name, arguments
  end
end