Module: Xcake::CoreExtensions::ClassDescendants

Included in:
Generator, Plugin::ClassMethods
Defined in:
lib/xcake/core_ext/class.rb

Overview

Examples:

Including in a class

extend Xcake::CoreExtensions::ClassDescendants

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 }.sort_by(&:to_s)
end