File: class.rb

package info (click to toggle)
ruby-specinfra 2.94.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,448 kB
  • sloc: ruby: 10,538; sh: 4; makefile: 4
file content (13 lines) | stat: -rw-r--r-- 294 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
class Class
  if !self.method_defined?(:subclasses)
    def subclasses
      result = []
      ObjectSpace.each_object(Class) do |k|
        next unless k < self
        next if k.respond_to?(:singleton_class?) && k.singleton_class?
        result << k
      end
      result
    end
  end
end