Sha256: 0b867bb9fd09babd8b9a9ccb1461556aad7327ef71528e949682d343139095d9

Contents?: true

Size: 949 Bytes

Versions: 5

Compression:

Stored size: 949 Bytes

Contents

module BuildTool


    #
    # Mixin which implements basic plugin functionality.
    #
    module PluginBase

        # Class methods
        module ClassMethods

            def register_plugin( child )
                logger.debug "Registering plugin #{child}"
                child.registered_plugins << child
            end

            # Called if the class is inherited
            def inherited( child )
                child.register_plugin( child )
            end

            def registered_plugins
                @@registered_plugins
            end

            def registered_plugins=( val )
                @@registered_plugins = val
            end

        end


        # Mixin the class methods
        def self.included( base )
            base.extend( ClassMethods )
            base.registered_plugins = Array.new
            # puts "#{base} #{base.registered_plugins.inspect}"
        end

    end # class PluginBase


end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
build-tool-0.1.4 lib/build-tool/pluginbase.rb
build-tool-0.1.3 lib/build-tool/pluginbase.rb
build-tool-0.1.2 lib/build-tool/pluginbase.rb
build-tool-0.1.0 lib/build-tool/pluginbase.rb
build-tool-0.1.1 lib/build-tool/pluginbase.rb