Class: ActiveMethod::Executor

Inherits:
Object
  • Object
show all
Defined in:
lib/active_method/executor.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(klass, owner) ⇒ Executor

Returns a new instance of Executor.



6
7
8
9
# File 'lib/active_method/executor.rb', line 6

def initialize(klass, owner)
  @method_class = klass
  @owner = owner
end

Instance Attribute Details

#method_classObject (readonly)

Returns the value of attribute method_class.



4
5
6
# File 'lib/active_method/executor.rb', line 4

def method_class
  @method_class
end

#ownerObject (readonly)

Returns the value of attribute owner.



4
5
6
# File 'lib/active_method/executor.rb', line 4

def owner
  @owner
end

Instance Method Details

#call(*args, &block) ⇒ Object



11
12
13
14
15
# File 'lib/active_method/executor.rb', line 11

def call(*args, &block)
  method = method_class.new(*args)
  method.__set_owner(owner)
  method.call(&block)
end