Skip to content

Instantly share code, notes, and snippets.

Created November 15, 2011 09:49
  • Star 0 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
find subclasses
def self.all
results = []
ObjectSpace.each_object(Class) do |c|
(results << c) if c.ancestors.include?(PullSource) && c != PullSource
Copy link

ruby-1.9.2-p290 :017 > PhPullSource.ancestors
=> [PhPullSource, PullSource, Object, ActiveSupport::Dependencies::Loadable, PP::ObjectMixin, Mongoid::Extensions::Object::Yoda, Mongoid::Extensions::Object::Substitutable, Mongoid::Extensions::Object::Reflections, Mongoid::Extensions::Object::Checks, JSON::Ext::Generator::GeneratorMethods::Object, Kernel, BasicObject]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment