Sha256: aa5ee3b1b5f176ce6e8f7e42f68adc7acb9e8ad8eb7c4c85625eec908ffb67a6
Contents?: true
Size: 396 Bytes
Versions: 2
Compression:
Stored size: 396 Bytes
Contents
class Class def inherited(klass) # Check the class instance variable so we don't eagerly initialize empty # arrays for every class (i.e. object). return if @inherited_hooks.nil? inherited_hooks.each do |block| klass.class_eval(&block) end end def inherited_hooks @inherited_hooks ||= [] end def on_inherit(&block) inherited_hooks << block end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
heredity-0.1.2 | lib/heredity/core_ext/class.rb |
heredity-0.1.1 | lib/heredity/core_ext/class.rb |