Module: SolidCallback::Hooks
- Defined in:
- lib/solid_callback/hooks.rb
Instance Method Summary collapse
-
#after_call(method_name, options = {}) ⇒ Object
After hooks.
-
#around_call(method_name, options = {}) ⇒ Object
Around hooks.
-
#before_call(method_name, options = {}) ⇒ Object
Before hooks.
-
#skip_callbacks_for(*method_names) ⇒ Object
Skip callbacks for specific methods.
-
#wrap_methods(*method_names) ⇒ Object
Register all methods that need callbacks.
Instance Method Details
#after_call(method_name, options = {}) ⇒ Object
After hooks
9 10 11 |
# File 'lib/solid_callback/hooks.rb', line 9 def after_call(method_name, = {}) register_callback(:after, method_name, ) end |
#around_call(method_name, options = {}) ⇒ Object
Around hooks
14 15 16 |
# File 'lib/solid_callback/hooks.rb', line 14 def around_call(method_name, = {}) register_callback(:around, method_name, ) end |
#before_call(method_name, options = {}) ⇒ Object
Before hooks
4 5 6 |
# File 'lib/solid_callback/hooks.rb', line 4 def before_call(method_name, = {}) register_callback(:before, method_name, ) end |
#skip_callbacks_for(*method_names) ⇒ Object
Skip callbacks for specific methods
26 27 28 29 |
# File 'lib/solid_callback/hooks.rb', line 26 def skip_callbacks_for(*method_names) @_solid_callback_skip_methods ||= [] @_solid_callback_skip_methods.concat(method_names) end |
#wrap_methods(*method_names) ⇒ Object
Register all methods that need callbacks
19 20 21 22 23 |
# File 'lib/solid_callback/hooks.rb', line 19 def wrap_methods(*method_names) method_names.each do |method_name| wrap_method_with_callbacks(method_name) if method_defined?(method_name) end end |