lib/pancake/hooks/on_inherit.rb in pancake-0.1.29 vs lib/pancake/hooks/on_inherit.rb in pancake-0.2.0
- old
+ new
@@ -1,26 +1,26 @@
module Pancake
module Hooks
module OnInherit
def self.extended(base)
base.class_eval do
- class_inheritable_reader :_on_inherit
+ extlib_inheritable_reader :_on_inherit
@_on_inherit = []
end
end
-
+
# Provides an inheritance hook to all extended classes
- # Allows ou to hook into the inheritance
+ # Allows ou to hook into the inheritance
def inherited(base)
super
_on_inherit.each{|b| b.call(base,self)}
end
-
+
# A hook to add code when the stack is inherited
# The code will be executed when the class is inherited
- #
- # @example
+ #
+ # @example
# MyClass.on_inherit do |base, parent|
# # do stuff here between the child and parent
# end
#
# @api public
@@ -29,6 +29,6 @@
_on_inherit << block if block
_on_inherit
end
end # OnInherit
end # Hooks
-end # Pancake
\ No newline at end of file
+end # Pancake