lib/masterview/plugin_load_tracking.rb in masterview-0.2.2 vs lib/masterview/plugin_load_tracking.rb in masterview-0.2.3
- old
+ new
@@ -1,32 +1,41 @@
module MasterView
- # mix this in so that these become class methods
- # mix in like so
+ # Mixin for directive implementation classes which
+ # automatically registers a directive implementation class
+ # in the MasterView directives registry.
+ #
+ # Subclasses of MasterView::DirectiveBase inherit this mechanism
+ # and will be registered automatically without additional
+ # action on the part of the class developer.
+ #
+ # If you are implementing a directive without subclassing
+ # MasterView::DirectiveBase, mix this module into your directive
+ # class by using the standard Ruby <code>include</code> statement.
+ #
# 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
+ #ISSUE: do we really need both PluginLoadTracking.register_class
+ #and DirectiveBase.register_directive, in addition to MasterView.register_directive???
+ #[DJL 04-Jul-2006]
+ MasterView.register_directive(plugin_class)
end
end
def self::included(other_module)