Module: Basis::Hooks

Defined in:
lib/basis/hooks.rb

Class Method Summary collapse

Class Method Details

.fire(name, *args) ⇒ Object



3
4
5
# File 'lib/basis/hooks.rb', line 3

def self.fire name, *args
  hooks[name].each { |h| h.call *args }
end

.hooksObject



7
8
9
# File 'lib/basis/hooks.rb', line 7

def self.hooks
  @hooks ||= Hash.new { |h, k| h[k] = [] }
end

.on(name, &block) ⇒ Object



11
12
13
# File 'lib/basis/hooks.rb', line 11

def self.on name, &block
  hooks[name] << block
end