Module: Hooki::ClassMethods
- Defined in:
- lib/hooki/class_methods.rb
Instance Method Summary collapse
- #after_method(method_name, only: [], except: []) ⇒ Object
- #after_singleton_method(method_name, only: [], except: []) ⇒ Object
- #before_method(method_name, only: [], except: []) ⇒ Object
- #before_singleton_method(method_name, only: [], except: []) ⇒ Object
Instance Method Details
#after_method(method_name, only: [], except: []) ⇒ Object
32 33 34 35 36 37 38 39 |
# File 'lib/hooki/class_methods.rb', line 32 def after_method(method_name, only: [], except: []) callback = { callback_method_name: method_name, only: wrap(only), except: wrap(except) } with_lock do @after_method_callbacks << callback @ignore_methods << method_name end callback end |
#after_singleton_method(method_name, only: [], except: []) ⇒ Object
14 15 16 17 18 19 20 21 |
# File 'lib/hooki/class_methods.rb', line 14 def after_singleton_method(method_name, only: [], except: []) callback = { callback_method_name: method_name, only: wrap(only), except: wrap(except) } with_lock do @after_singleton_method_callbacks << callback @ignore_singleton_methods << method_name end callback end |
#before_method(method_name, only: [], except: []) ⇒ Object
23 24 25 26 27 28 29 30 |
# File 'lib/hooki/class_methods.rb', line 23 def before_method(method_name, only: [], except: []) callback = { callback_method_name: method_name, only: wrap(only), except: wrap(except) } with_lock do @before_method_callbacks << callback @ignore_methods << method_name end callback end |
#before_singleton_method(method_name, only: [], except: []) ⇒ Object
5 6 7 8 9 10 11 12 |
# File 'lib/hooki/class_methods.rb', line 5 def before_singleton_method(method_name, only: [], except: []) callback = { callback_method_name: method_name, only: wrap(only), except: wrap(except) } with_lock do @before_singleton_method_callbacks << callback @ignore_singleton_methods << method_name end callback end |