Module: Xcake::CoreExtensions::ClassDescendants

Defined in:
lib/xcake/core_ext/class.rb

Overview

Examples:

Including in a class

Class.send(:include, Xcake::CoreExtensions::ClassDescendants) # done with send because of old ruby versions

Instance Method Summary collapse

Instance Method Details

#descendantsObject

Returns all descendants of a class



9
10
11
# File 'lib/xcake/core_ext/class.rb', line 9

def descendants
  ObjectSpace.each_object(singleton_class).select { |klass| klass < self }
end