Namespace
Methods
- C
- R
- T
- W
Included Modules
Constants
Null | = | Object.new # :nodoc: |
RunHook | = | Struct.new(:hook) do # :nodoc: def before(target) hook_state = target.send(:hook_state) hook_state[hook] = hook.run end end |
CompleteHook | = | Struct.new(:hook) do # :nodoc: def before(target) hook_state = target.send(:hook_state) if hook_state.key?(hook) hook.complete hook_state[hook] end end alias after before end |
Attributes
[RW] | active |
Class Public methods
register_hook(hook, outer: false)
Link
Register an object to be invoked during both the run
and
complete
steps.
hook.complete
will be passed the value returned from
hook.run
, and will only be invoked if run
has
previously been called. (Mostly, this means it won't be invoked if an
exception occurs in a preceding to_run
block; all ordinary
to_complete
blocks are invoked in that situation.)
# File activesupport/lib/active_support/execution_wrapper.rb, line 47 def self.register_hook(hook, outer: false) if outer to_run RunHook.new(hook), prepend: true to_complete :after, CompleteHook.new(hook) else to_run RunHook.new(hook) to_complete CompleteHook.new(hook) end end
run!()
Link
Run this execution.
Returns an instance, whose complete!
method
must be invoked after the work has been performed.
Where possible, prefer wrap
.
to_complete(*args, &block)
Link
to_run(*args, &block)
Link
wrap()
Link
Perform the work in the supplied block as an execution.
Instance Public methods
complete!()
Link
Complete this in-flight execution. This method must be
called exactly once on the result of any call to run!
.
Where possible, prefer wrap
.