Sha256: b3afe78855650e954fd1b26e10c2dc4e1d94acaf42fd3b20cf0eee314f5daf01

Contents?: true

Size: 278 Bytes

Versions: 6

Compression:

Stored size: 278 Bytes

Contents

unless Class.method_defined? :subclasses
  require 'backports/2.1.0/module/singleton_class'

  class Class
    def subclasses
      ObjectSpace.each_object(singleton_class).reject do |klass|
        klass.superclass != self || klass.singleton_class?
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
backports-3.25.0 lib/backports/3.1.0/class/subclasses.rb
backports-3.24.1 lib/backports/3.1.0/class/subclasses.rb
backports-3.24.0 lib/backports/3.1.0/class/subclasses.rb
backports-3.23.0 lib/backports/3.1.0/class/subclasses.rb
backports-3.22.1 lib/backports/3.1.0/class/subclasses.rb
backports-3.22.0 lib/backports/3.1.0/class/subclasses.rb