Method: MPatch::Include::Class#each_subclass

Defined in:
lib/mpatch/class.rb

#each_subclassObject

Iterates over all subclasses (direct and indirect)



31
32
33
34
35
36
37
38
39
# File 'lib/mpatch/class.rb', line 31

def each_subclass
  ::ObjectSpace.each_object(::Class) { | candidate |
    begin
      yield candidate if candidate < self
    rescue ::ArgumentError
      # comparison of Class with Class failed (ArgumentError)
    end
  }
end