Example of Detecting Subclasses
def A.inherited(clazz)
puts "Hey, #{clazz} is subclassing me"
end
end
class B < A; end
Produces:
$ ruby x.rb
Hey, B is subclassing me
DZone Snippets > jimweirich > hook
13480 users tagging and storing useful source code snippets
Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world
Jim Weirich http://onestepback.org