Module: Rango::Hookable

Public Visibility

Public Instance Method Summary

#hooks
#install_hook(&block)
#new(*args)

Public Instance Method Details

hooks

public hooks
[View source]


24
25
26
# File 'lib/rango/mixins/hookable.rb', line 24

def hooks
  @hooks ||= Array.new
end

install_hook

public install_hook(&block)
[View source]


28
29
30
# File 'lib/rango/mixins/hookable.rb', line 28

def install_hook(&block)
  self.hooks.push(block)
end

new

public new(*args)
[View source]


18
19
20
21
22
# File 'lib/rango/mixins/hookable.rb', line 18

def new(*args)
  instance = super(*args)
  self.hooks.each { |hook| hook.call(instance) }
  return instance
end