class Aruba::Hooks
Attributes
Public Class Methods
Public Instance Methods
Source
# File lib/aruba/hooks.rb, line 23 def append(label, block) unless store.key?(label.to_sym) && store[label.to_sym].respond_to?(:<<) store[label.to_sym] = [] end store[label.to_sym] << block end
Add new hook
@param [String, Symbol] label
The name of the hook
@param [Proc] block
The block which should be run for the hook
Source
# File lib/aruba/hooks.rb, line 40 def execute(label, context, *args) Array(store[label.to_sym]).each do |block| context.instance_exec(*args, &block) end end
Run hook
@param [String, Symbol] label
The name of the hook
@param [Object] context
The context in which the hook is run
@param [Array] args
Other arguments
Source
# File lib/aruba/hooks.rb, line 50 def exist?(label) store.key? label.to_sym end
Check if hook exist
@param [String, Symbol] label
The name of the hook