Module: Falqon::Hooks::ClassMethods
- Extended by:
- T::Sig
- Includes:
- Kernel
- Defined in:
- lib/falqon/concerns/hooks.rb
Instance Method Summary collapse
-
#after(event, method_sym = nil, &block) ⇒ void
Add hook to after list (either the given block or a wrapped method call).
-
#before(event, method_sym = nil, &block) ⇒ void
Add hook to before list (either the given block or a wrapped method call).
Instance Method Details
#after(event, method_sym = nil, &block) ⇒ void
This method returns an undefined value.
Add hook to after list (either the given block or a wrapped method call)
94 95 96 97 98 |
# File 'lib/falqon/concerns/hooks.rb', line 94 def after(event, method_sym = nil, &block) block ||= proc { send(method_sym) } if method_sym T.must(T.must(hooks[event])[:after]) << block if block end |
#before(event, method_sym = nil, &block) ⇒ void
This method returns an undefined value.
Add hook to before list (either the given block or a wrapped method call)
80 81 82 83 84 |
# File 'lib/falqon/concerns/hooks.rb', line 80 def before(event, method_sym = nil, &block) block ||= proc { send(method_sym) } if method_sym T.must(T.must(hooks[event])[:before]) << block if block end |