Module: CanTango::Ability::Callbacks
- Includes:
- Helpers::Debug
- Included in:
- Executor, Executor::Base
- Defined in:
- lib/cantango/ability/callbacks.rb
Defined Under Namespace
Modules: ClassMethods
Instance Attribute Summary
Attributes included from Helpers::Debug
Class Method Summary collapse
Instance Method Summary collapse
-
#handle_callbacks(type) ⇒ Object
should execute :after_execute callbacks.
- #within_callbacks(&block) ⇒ Object
Methods included from Helpers::Debug
Class Method Details
.included(base) ⇒ Object
5 6 7 |
# File 'lib/cantango/ability/callbacks.rb', line 5 def self.included(base) base.extend ClassMethods end |
Instance Method Details
#handle_callbacks(type) ⇒ Object
should execute :after_execute callbacks
24 25 26 27 28 |
# File 'lib/cantango/ability/callbacks.rb', line 24 def handle_callbacks type callbacks_method = "#{type}_execute_callbacks" raise ArgumentError, "Not a valid callback type: #{type}" if !self.class.respond_to? callbacks_method self.class.send(callbacks_method).each {|callback| send(callback) } end |
#within_callbacks(&block) ⇒ Object
30 31 32 33 34 |
# File 'lib/cantango/ability/callbacks.rb', line 30 def within_callbacks &block handle_callbacks :before yield handle_callbacks :after end |