Class: Workflow::Callbacks::TransitionCallbacks::ProcCaller Private

Inherits:
Workflow::Callbacks::TransitionCallback show all
Defined in:
lib/workflow/callbacks/transition_callbacks/proc_caller.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.

A Workflow::Callbacks::TransitionCallback that wraps a callback proc.

Defined Under Namespace

Classes: AroundProcArgBuilder, NormalProcArgBuilder

Instance Attribute Summary

Attributes inherited from Workflow::Callbacks::TransitionCallback

#callback_type, #calling_class, #raw_proc

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Workflow::Callbacks::TransitionCallback

#call, #initialize

Constructor Details

This class inherits a constructor from Workflow::Callbacks::TransitionCallback

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.



22
23
24
25
# File 'lib/workflow/callbacks/transition_callbacks/proc_caller.rb', line 22

def build(callback_type, raw_proc, calling_class)
  return raw_proc if basic_callback?(raw_proc, callback_type)
  new(callback_type, raw_proc, calling_class)
end

Instance Method Details

#around_proc(target, callbacks) ⇒ 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.



15
16
17
18
19
# File 'lib/workflow/callbacks/transition_callbacks/proc_caller.rb', line 15

def around_proc(target, callbacks)
  transition_context = target.send :transition_context
  builder = AroundProcArgBuilder.new(transition_context, raw_proc)
  target.instance_exec target, callbacks, *builder.args, &raw_proc
end

#normal_proc(target) ⇒ 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.



9
10
11
12
13
# File 'lib/workflow/callbacks/transition_callbacks/proc_caller.rb', line 9

def normal_proc(target)
  transition_context = target.send :transition_context
  builder = NormalProcArgBuilder.new(transition_context, raw_proc)
  target.instance_exec target, *builder.args, &raw_proc
end