Sha256: 2ed3064b545d621f44f8505694002dc70445ed85c2ac70dff8dec3ca5b5e458f

Contents?: true

Size: 320 Bytes

Versions: 3

Compression:

Stored size: 320 Bytes

Contents

# frozen_string_literal: true

module Refinements
  # Provides additional enhancements to Class objects.
  module Classes
    refine Class do
      def descendants
        ObjectSpace.each_object(singleton_class)
                   .reject { |klass| klass.singleton_class? || klass == self }
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
refinements-8.5.2 lib/refinements/classes.rb
refinements-8.5.1 lib/refinements/classes.rb
refinements-8.5.0 lib/refinements/classes.rb