Sha256: 8cb1ae5f35bf60b3bbb5f85cdbf61045b2b3ad11a62b54871067658b439b05d4

Contents?: true

Size: 542 Bytes

Versions: 23

Compression:

Stored size: 542 Bytes

Contents

# frozen_string_literal: true

require "active_support/descendants_tracker"

class Class
  # Returns an array with all classes that are < than its receiver.
  #
  #   class C; end
  #   C.descendants # => []
  #
  #   class B < C; end
  #   C.descendants # => [B]
  #
  #   class A < B; end
  #   C.descendants # => [B, A]
  #
  #   class D < C; end
  #   C.descendants # => [B, A, D]
  def descendants
    subclasses.concat(subclasses.flat_map(&:descendants))
  end

  prepend ActiveSupport::DescendantsTracker::ReloadedClassesFiltering
end

Version data entries

23 entries across 23 versions & 2 rubygems

Version Path
activesupport-8.0.1 lib/active_support/core_ext/class/subclasses.rb
activesupport-8.0.0.1 lib/active_support/core_ext/class/subclasses.rb
activesupport-7.2.2.1 lib/active_support/core_ext/class/subclasses.rb
activesupport-8.0.0 lib/active_support/core_ext/class/subclasses.rb
activesupport-7.2.2 lib/active_support/core_ext/class/subclasses.rb
activesupport-8.0.0.rc2 lib/active_support/core_ext/class/subclasses.rb
activesupport-7.2.1.2 lib/active_support/core_ext/class/subclasses.rb
activesupport-8.0.0.rc1 lib/active_support/core_ext/class/subclasses.rb
activesupport-7.2.1.1 lib/active_support/core_ext/class/subclasses.rb
activesupport-8.0.0.beta1 lib/active_support/core_ext/class/subclasses.rb
omg-activesupport-8.0.0.alpha9 lib/active_support/core_ext/class/subclasses.rb
omg-activesupport-8.0.0.alpha8 lib/active_support/core_ext/class/subclasses.rb
omg-activesupport-8.0.0.alpha7 lib/active_support/core_ext/class/subclasses.rb
omg-activesupport-8.0.0.alpha4 lib/active_support/core_ext/class/subclasses.rb
omg-activesupport-8.0.0.alpha3 lib/active_support/core_ext/class/subclasses.rb
omg-activesupport-8.0.0.alpha2 lib/active_support/core_ext/class/subclasses.rb
omg-activesupport-8.0.0.alpha1 lib/active_support/core_ext/class/subclasses.rb
activesupport-7.2.1 lib/active_support/core_ext/class/subclasses.rb
activesupport-7.2.0 lib/active_support/core_ext/class/subclasses.rb
activesupport-7.2.0.rc1 lib/active_support/core_ext/class/subclasses.rb