Module: Sequel::Plugins::Subclasses

Module | Sequel::Plugins::Subclasses
In: | lib/sequel/plugins/subclasses.rb

The Subclasses plugin keeps track of all subclasses of the current model class. Direct subclasses are available via the subclasses method, and all descendent classes are available via the descendents method.

      c = Class.new(Sequel::Model)
      c.plugin :subclasses
      sc1 = Class.new(c)
      sc2 = Class.new(c)
      ssc1 = Class.new(sc1)
      c.subclasses    # [sc1, sc2]
      sc1.subclasses  # [ssc1]
      sc2.subclasses  # []
      ssc1.subclasses # []
      c.descendents   # [sc1, ssc1, sc2]

### Methods

apply

### Classes and Modules

Module Sequel::Plugins::Subclasses::ClassMethods

### Public Class methods

apply(model, &block)

Initialize the subclasses instance variable for the model.

[Source]

        # File lib/sequel/plugins/subclasses.rb, line 20
    20:       def self.apply(model, &block)
    21:         model.instance_variable_set(:@subclasses, [])
    22:       end

[Validate]