Module: Lotus::Action::Callbacks::ClassMethods Private
- Defined in:
- lib/lotus/action/callbacks.rb
Overview
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
Callbacks API class methods
Class Method Summary collapse
-
.extended(base) ⇒ Object
private
Override Ruby’s hook for modules.
Instance Method Summary collapse
-
#append_after(*callbacks, &blk) ⇒ void
(also: #after)
private
Define a callback for an Action.
-
#append_before(*callbacks, &blk) ⇒ void
(also: #before)
private
Define a callback for an Action.
-
#prepend_after(*callbacks, &blk) ⇒ void
private
Define a callback for an Action.
-
#prepend_before(*callbacks, &blk) ⇒ void
private
Define a callback for an Action.
Class Method Details
.extended(base) ⇒ 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.
Override Ruby’s hook for modules. It includes callbacks logic
42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/lotus/action/callbacks.rb', line 42 def self.extended(base) base.class_eval do include Utils::ClassAttribute class_attribute :before_callbacks self.before_callbacks = Utils::Callbacks::Chain.new class_attribute :after_callbacks self.after_callbacks = Utils::Callbacks::Chain.new end end |
Instance Method Details
#append_after(*callbacks, &blk) ⇒ void Also known as: after
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.
This method returns an undefined value.
Define a callback for an Action. The callback will be executed after the action is called, in the order they are added.
138 139 140 |
# File 'lib/lotus/action/callbacks.rb', line 138 def append_after(*callbacks, &blk) after_callbacks.append(*callbacks, &blk) end |
#append_before(*callbacks, &blk) ⇒ void Also known as: before
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.
This method returns an undefined value.
Define a callback for an Action. The callback will be executed before the action is called, in the order they are added.
116 117 118 |
# File 'lib/lotus/action/callbacks.rb', line 116 def append_before(*callbacks, &blk) before_callbacks.append(*callbacks, &blk) end |
#prepend_after(*callbacks, &blk) ⇒ void
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.
This method returns an undefined value.
Define a callback for an Action. The callback will be executed after the action is called. It will add the callback at the beginning of the callbacks’ chain.
179 180 181 |
# File 'lib/lotus/action/callbacks.rb', line 179 def prepend_after(*callbacks, &blk) after_callbacks.prepend(*callbacks, &blk) end |
#prepend_before(*callbacks, &blk) ⇒ void
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.
This method returns an undefined value.
Define a callback for an Action. The callback will be executed before the action is called. It will add the callback at the beginning of the callbacks’ chain.
160 161 162 |
# File 'lib/lotus/action/callbacks.rb', line 160 def prepend_before(*callbacks, &blk) before_callbacks.prepend(*callbacks, &blk) end |