Module: ActiveFunction::Functions::Callbacks
- Defined in:
- lib/active_function/functions/callbacks.rb
Overview
Setups #before_action and #after_action callbacks around SuperBase#process using ActiveFunctionCore::Plugins::Hooks. Also provides #define_hooks_for and #set_callback_options for defining custom hooks & options.
defining custom hooks & options.
Class Method Summary collapse
-
.included(base) ⇒ Object
Setup callbacks around Base#process method using ActiveFunctionCore::Plugins::Hooks.
Instance Method Summary collapse
- #after_action(target, options) ⇒ Object
- #before_action(target, options) ⇒ Object
- #define_hooks_for(method_name, name: method_name) ⇒ Object
- #set_callback(type, hook_name, target, options) ⇒ Object
- #set_callback_options(options) ⇒ Object
Class Method Details
.included(base) ⇒ Object
Setup callbacks around Base#process method using ActiveFunctionCore::Plugins::Hooks. Also provides :only option for filtering callbacks by action name.
40 41 42 43 44 |
# File 'lib/active_function/functions/callbacks.rb', line 40 def self.included(base) base.include ActiveFunctionCore::Plugins::Hooks base.define_hooks_for :process, name: :action base. only: ->(args, context:) { args.to_set === context.action_name } end |
Instance Method Details
#after_action(target, options) ⇒ Object
|
# File 'lib/active_function/functions/callbacks.rb', line 46
|
#before_action(target, options) ⇒ Object
|
# File 'lib/active_function/functions/callbacks.rb', line 46
|
#define_hooks_for(method_name, name: method_name) ⇒ Object
|
# File 'lib/active_function/functions/callbacks.rb', line 62
|
#set_callback(type, hook_name, target, options) ⇒ Object
|
# File 'lib/active_function/functions/callbacks.rb', line 59
|
#set_callback_options(options) ⇒ Object
|
# File 'lib/active_function/functions/callbacks.rb', line 65
|