Sha256: 86adbdf41e8468a4335df35adca38b72b330f1f167636c136b1d83fe8b1c34bd
Contents?: true
Size: 470 Bytes
Versions: 4
Compression:
Stored size: 470 Bytes
Contents
# encoding: utf-8 # class Test # extend Rango::Hookable # install_hook do |instance| # p instance # end # # def initialize # p self # end # end # # Test.new module RubyExts module Hookable def new(*args) instance = super(*args) self.hooks.each { |hook| hook.call(instance) } return instance end def hooks @hooks ||= Array.new end def install_hook(&block) self.hooks.push(block) end end end
Version data entries
4 entries across 4 versions & 1 rubygems