Sha256: 42df94d60380611b94aa48e8ec8e3832b34152b815b7d28acb5ad931077df649

Contents?: true

Size: 414 Bytes

Versions: 5

Compression:

Stored size: 414 Bytes

Contents

module Xcake
  module CoreExtensions
    # @example  Including in a class
    #           Class.send(:include, Xcake::CoreExtensions::ClassDescendants) # done with send because of old ruby versions
    #
    module ClassDescendants
      # Returns all descendants of a class
      #
      def descendants
        ObjectSpace.each_object(singleton_class).select { |klass| klass < self }
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
xcake-0.9.4 lib/xcake/core_ext/class.rb
xcake-0.9.3 lib/xcake/core_ext/class.rb
xcake-0.9.2 lib/xcake/core_ext/class.rb
xcake-0.9.1 lib/xcake/core_ext/class.rb
xcake-0.9.0 lib/xcake/core_ext/class.rb