Module: RubyExts::Hookable
- Defined in:
- lib/rubyexts/mixins/hookable.rb
Instance Method Summary collapse
Instance Method Details
#hooks ⇒ Object
24 25 26 |
# File 'lib/rubyexts/mixins/hookable.rb', line 24 def hooks @hooks ||= Array.new end |
#install_hook(&block) ⇒ Object
28 29 30 |
# File 'lib/rubyexts/mixins/hookable.rb', line 28 def install_hook(&block) self.hooks.push(block) end |
#new(*args) ⇒ Object
18 19 20 21 22 |
# File 'lib/rubyexts/mixins/hookable.rb', line 18 def new(*args) instance = super(*args) self.hooks.each { |hook| hook.call(instance) } return instance end |