module Spinach::Hookable::ClassMethods
Public Instance Methods
around_hook(hook)
click to toggle source
Adds a new around_hook
to this class. Every hook defines two methods used to add new callbacks and to run them around a given block of code passing a bunch of parameters and invoking them in the order they were defined.
@example
class
# File lib/spinach/hookable.rb, line 39 def around_hook(hook) define_method hook do |&block| add_hook(hook, &block) end define_method "run_#{hook}" do |*args, &block| run_around_hook(hook, *args, &block) end end
hook(hook)
click to toggle source
Adds a new hook to this class. Every hook defines two methods used to add new callbacks and to run them passing a bunch of parameters.
@example
class
# File lib/spinach/hookable.rb, line 23 def hook(hook) define_method hook do |&block| add_hook(hook, &block) end define_method "run_#{hook}" do |*args, &block| run_hook(hook, *args, &block) end end