Sha256: 13e92ac1228af5980a861282bdd488eb99c243a96cc4ea769e5137b80125e133

Contents?: true

Size: 1.42 KB

Versions: 8

Compression:

Stored size: 1.42 KB

Contents

module MasterView

  # 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

      # 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)
        #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)
      other_module.module_eval{ include InstanceMethods }
      other_module.extend ClassMethods
      other_module
    end

  end

end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
masterview-0.2.3 lib/masterview/plugin_load_tracking.rb
masterview-0.2.4 lib/masterview/plugin_load_tracking.rb
masterview-0.3.0 lib/masterview/plugin_load_tracking.rb
masterview-0.3.1 lib/masterview/plugin_load_tracking.rb
masterview-0.2.5 lib/masterview/plugin_load_tracking.rb
masterview-0.3.2 lib/masterview/plugin_load_tracking.rb
masterview-0.3.3 lib/masterview/plugin_load_tracking.rb
masterview-0.3.4 lib/masterview/plugin_load_tracking.rb