Sha256: d839290b241ba9f76c8a069e5f764a970f93535dfbc57b083bfede0536c10eb4

Contents?: true

Size: 369 Bytes

Versions: 3

Compression:

Stored size: 369 Bytes

Contents

module Xcake
  module CoreExtensions
    # @example  Including in a class
    #           extend Xcake::CoreExtensions::ClassDescendants
    #
    module ClassDescendants
      # Returns all descendants of a class
      #
      def descendants
        ObjectSpace.each_object(singleton_class).select { |klass| klass < self }.sort_by(&:to_s)
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
xcake-0.13.0 lib/xcake/core_ext/class.rb
xcake-0.12.1 lib/xcake/core_ext/class.rb
xcake-0.12.0 lib/xcake/core_ext/class.rb