Module: SolidCallback
- Defined in:
- lib/solid_callback.rb,
lib/solid_callback/core.rb,
lib/solid_callback/hooks.rb,
lib/solid_callback/version.rb,
lib/solid_callback/method_wrapper.rb
Defined Under Namespace
Modules: Core, Hooks, MethodWrapper Classes: Error
Constant Summary collapse
- VERSION =
"2.0.2"
Class Method Summary collapse
-
.included(base) ⇒ Object
This method is called when the module is included in a class.
Class Method Details
.included(base) ⇒ Object
This method is called when the module is included in a class
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/solid_callback.rb', line 12 def self.included(base) base.extend(SolidCallback::Core) base.extend(SolidCallback::Hooks) base.send(:include, SolidCallback::MethodWrapper) # Initialize callback store on the class base.instance_variable_set(:@_solid_callback_store, { before: {}, after: {}, around: {} }) # Setup method_added hook to handle methods defined after including SolidCallback base.singleton_class.prepend(Module.new do def method_added(method_name) super # Delegate to SolidCallback's method added handler handle_method_added(method_name) if respond_to?(:handle_method_added) end end) end |