Skip to content

Instantly share code, notes, and snippets.

@jimweirich
Created May 28, 2009 16:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jimweirich/119417 to your computer and use it in GitHub Desktop.
Save jimweirich/119417 to your computer and use it in GitHub Desktop.
class Parent
class << self
def children
@children ||= []
end
def inherited(cls)
children << cls
end
end
end
class Child1 < Parent
end
class Child2 < Parent
end
puts Parent.children
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment