module MasterView # mix this in so that these become class methods # mix in like so # class FooPluginBase # include PluginLoadTracking # end module PluginLoadTracking module InstanceMethods #put any instance methods here end module ClassMethods @@loaded_classes = [] # called when a class inherits from this def inherited(plugin_class) self.register_class(plugin_class) end # register a loaded class, called from inherited and can be called manually. def register_class(plugin_class) @@loaded_classes << plugin_class end def loaded_classes @@loaded_classes end end def self::included(other_module) other_module.module_eval{ include InstanceMethods } other_module.extend ClassMethods other_module end end end