Class: Workflow::Callbacks::TransitionCallback Private
- Inherits:
-
Object
- Object
- Workflow::Callbacks::TransitionCallback
- Defined in:
- lib/workflow/callbacks/transition_callback.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Wrapper object for proc and method callbacks, when that proc or method is intended to receive arguments that were passed to the transition. When the method/proc is to be called, a MethodArgumentBuilder determines and generates the array of arguments to send to the method.
Direct Known Subclasses
Workflow::Callbacks::TransitionCallbacks::MethodCaller, Workflow::Callbacks::TransitionCallbacks::ProcCaller
Defined Under Namespace
Classes: MethodArgumentBuilder
Instance Attribute Summary collapse
- #callback_type ⇒ Object readonly private
- #calling_class ⇒ Object readonly private
- #raw_proc ⇒ Object readonly private
Class Method Summary collapse
Instance Method Summary collapse
- #call(target, _value, &block) ⇒ Object private
-
#initialize(callback_type, raw_proc, calling_class) ⇒ TransitionCallback
constructor
private
A new instance of TransitionCallback.
Constructor Details
#initialize(callback_type, raw_proc, calling_class) ⇒ TransitionCallback
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of TransitionCallback.
14 15 16 17 18 |
# File 'lib/workflow/callbacks/transition_callback.rb', line 14 def initialize(callback_type, raw_proc, calling_class) @callback_type = callback_type @raw_proc = raw_proc @calling_class = calling_class end |
Instance Attribute Details
#callback_type ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
13 14 15 |
# File 'lib/workflow/callbacks/transition_callback.rb', line 13 def callback_type @callback_type end |
#calling_class ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
13 14 15 |
# File 'lib/workflow/callbacks/transition_callback.rb', line 13 def calling_class @calling_class end |
#raw_proc ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
13 14 15 |
# File 'lib/workflow/callbacks/transition_callback.rb', line 13 def raw_proc @raw_proc end |
Class Method Details
.build(callback_type, raw_proc, calling_class) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
29 30 31 32 33 34 35 36 37 |
# File 'lib/workflow/callbacks/transition_callback.rb', line 29 def build(callback_type, raw_proc, calling_class) case raw_proc when ::Proc TransitionCallbacks::ProcCaller.build(callback_type, raw_proc, calling_class) when ::Symbol TransitionCallbacks::MethodCaller.build(callback_type, raw_proc, calling_class) else raw_proc end end |
Instance Method Details
#call(target, _value, &block) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
20 21 22 23 24 25 26 |
# File 'lib/workflow/callbacks/transition_callback.rb', line 20 def call(target, _value, &block) if around_callback? around_proc(target, block) else normal_proc(target) end end |