Add the block as an instance level hook. For before hooks, add it to the beginning of the instance hook’s array. For after hooks, add it to the end.
# File lib/sequel/plugins/instance_hooks.rb, line 49 49: def add_instance_hook(hook, &block) 50: instance_hooks(hook).send(BEFORE_HOOKS.include?(hook) ? :unshift : :push, block) 51: end
An array of instance level hook blocks for the given hook type.
# File lib/sequel/plugins/instance_hooks.rb, line 54 54: def instance_hooks(hook) 55: @instance_hooks ||= {} 56: @instance_hooks[hook] ||= [] 57: end
Run all hook blocks of the given hook type.
# File lib/sequel/plugins/instance_hooks.rb, line 60 60: def run_after_instance_hooks(hook) 61: instance_hooks(hook).each{|b| b.call} 62: end
Run all hook blocks of the given hook type. If a hook block returns false, immediately return false without running the remaining blocks.
# File lib/sequel/plugins/instance_hooks.rb, line 66 66: def run_before_instance_hooks(hook) 67: instance_hooks(hook).each{|b| return false if b.call == false} 68: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.