Module: DescendantsTracker

### Home Classes Methods

### In Files

- lib/descendants_tracker.rb
- lib/descendants_tracker/version.rb

### Methods

- ::setup
- #add_descendant

### Files

- LICENSE
- TODO

### Class/Module Index

Quicksearch

- DescendantsTracker

No matching classes.

# DescendantsTracker

Module that adds descendant tracking to a class

### Constants

VERSION

  Unreleased gem version

### Attributes

descendants[R]

Return the descendants of this class

@example

    descendants = ParentClass.descendants

@return [Array<Class<DescendantsTracker>>]

@api public

### Public Class Methods

setup(descendant) click to toggle source

Setup the class for descendant tracking

@param [Class<DescendantsTracker>] descendant

@return [undefined]

@api private

    # File lib/descendants_tracker.rb, line 24
    def self.setup(descendant)
      descendant.instance_variable_set(:@descendants, ThreadSafe::Array.new)
    end

Also aliased as: extended

### Public Instance Methods

add_descendant(descendant) click to toggle source

Add the descendant to this class and the superclass

@param [Class] descendant

@return [self]

@api private

    # File lib/descendants_tracker.rb, line 40
    def add_descendant(descendant)
      ancestor = superclass
      if ancestor.respond_to?(:add_descendant)
        ancestor.add_descendant(descendant)
      end
      descendants.unshift(descendant)
      self
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.