Class: RR::ScenarioMethodProxy

Inherits:
Object
  • Object
show all
Defined in:
lib/rr/scenario_method_proxy.rb

Instance Method Summary collapse

Constructor Details

#initialize(space, creator, object) {|_self| ... } ⇒ ScenarioMethodProxy

Returns a new instance of ScenarioMethodProxy.

Yields:

  • (_self)

Yield Parameters:



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/rr/scenario_method_proxy.rb', line 3

def initialize(space, creator, object, &block)
  @space = space
  @creator = creator
  @object = object
  class << self
    instance_methods.each do |m|
      undef_method m unless m =~ /^__/
    end

    def method_missing(method_name, *args, &block)
      @creator.create!(@object, method_name, *args, &block)
    end
  end
  yield(self) if block_given?
end