Sha256: e23b0844032a6d296eb1a29522637ab166ae5b9438c280fb14ed9159003d5cd7

Contents?: true

Size: 862 Bytes

Versions: 24

Compression:

Stored size: 862 Bytes

Contents

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

Version data entries

24 entries across 24 versions & 2 rubygems

Version Path
masterview_parser-0.0.4 lib/masterview/plugin_load_tracking.rb
masterview_parser-0.0.6 lib/masterview/plugin_load_tracking.rb
masterview_parser-0.0.5 lib/masterview/plugin_load_tracking.rb
masterview_parser-0.0.3 lib/masterview/plugin_load_tracking.rb