Class: MethodCallbacks::Executor

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(method, type, object) ⇒ Executor

Returns a new instance of Executor.



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

def initialize(method, type, object)
  @method = method
  @type = type
  @object = object
end

Instance Attribute Details

#methodObject (readonly)

Returns the value of attribute method.



3
4
5
# File 'lib/method_callbacks/executor.rb', line 3

def method
  @method
end

#objectObject (readonly)

Returns the value of attribute object.



3
4
5
# File 'lib/method_callbacks/executor.rb', line 3

def object
  @object
end

#typeObject (readonly)

Returns the value of attribute type.



3
4
5
# File 'lib/method_callbacks/executor.rb', line 3

def type
  @type
end

Instance Method Details

#execute(&block) ⇒ Object



11
12
13
14
15
16
17
18
19
20
# File 'lib/method_callbacks/executor.rb', line 11

def execute(&block)
  case type
  when :proxy
    execute_proxy_callbacks(&block)
  when :around
    execute_around_callbacks(&block)
  else
    execute_callbacks
  end
end