mirror of
https://github.com/bobbimanners/emailler.git
synced 2024-11-15 02:04:28 +00:00
12 lines
364 B
Ruby
12 lines
364 B
Ruby
#derived from http://ola-bini.blogspot.com/2007/07/objectspace-to-have-or-not-to-have.html
|
|
module SubclassTracking
|
|
def self.extended(klazz)
|
|
(class <<klazz; self; end).send :attr_accessor, :subclasses
|
|
(class <<klazz; self; end).send :define_method, :inherited do |clzz|
|
|
klazz.subclasses << clzz
|
|
super
|
|
end
|
|
klazz.subclasses = []
|
|
end
|
|
end
|