Callable object that should be called with every descendent class created.
All subclasses for the current model. Does not include the model itself.
All descendent classes of this model.
# File lib/sequel/plugins/subclasses.rb, line 54 def descendents Sequel.synchronize{subclasses.dup}.map{|x| [x] + x.send(:descendents)}.flatten end
Freeze all descendent classes. This also finalizes the associations for those classes before freezing.
# File lib/sequel/plugins/subclasses.rb, line 60 def freeze_descendents descendents.each(&:finalize_associations).each(&:freeze) end
Add the subclass to this model’s current subclasses, and initialize a new subclasses instance variable in the subclass.
# File lib/sequel/plugins/subclasses.rb, line 69 def inherited(subclass) super Sequel.synchronize{subclasses << subclass} on_subclass.call(subclass) if on_subclass end