Sha256: c4a4f6f8678aabe1daf37b71e187c44050b6d294ca86dc5a202e16a93a363b77

Contents?: true

Size: 695 Bytes

Versions: 18

Compression:

Stored size: 695 Bytes

Contents

module Netzke::Core
  module Plugins
    extend ActiveSupport::Concern

    included do
      # Returns registered plugins
      class_attribute :registered_plugins
      self.registered_plugins = []
    end

    module ClassMethods
      # Defines a plugin
      def plugin(name, &block)
        register_plugin(name)
        component name do |c|
          block.call(c) if block_given?

          # plugins are *always* eagerly loaded
          c.eager_loading = true
        end
      end

    private
      # Register a plugin
      def register_plugin(name)
        self.registered_plugins |= [name]
      end
    end

    def plugins
      self.class.registered_plugins
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
netzke-core-0.12.3 lib/netzke/core/plugins.rb
netzke-core-0.12.2 lib/netzke/core/plugins.rb
netzke-core-0.12.1 lib/netzke/core/plugins.rb
netzke-core-0.12.0 lib/netzke/core/plugins.rb
netzke-core-0.12.0.rc1 lib/netzke/core/plugins.rb
netzke-core-0.12.0.beta lib/netzke/core/plugins.rb
netzke-core-0.11.0 lib/netzke/core/plugins.rb
netzke-core-0.10.1 lib/netzke/core/plugins.rb
netzke-core-0.10.0 lib/netzke/core/plugins.rb
netzke-core-0.9.0 lib/netzke/core/plugins.rb
netzke-core-0.10.0.rc2 lib/netzke/core/plugins.rb
netzke-core-0.10.0.rc1 lib/netzke/core/plugins.rb
netzke-core-0.9.0.rc1 lib/netzke/core/plugins.rb
netzke-core-0.8.4 lib/netzke/core/plugins.rb
netzke-core-0.8.3 lib/netzke/core/plugins.rb
netzke-core-0.8.2 lib/netzke/core/plugins.rb
netzke-core-0.8.1 lib/netzke/core/plugins.rb
netzke-core-0.8.0 lib/netzke/core/plugins.rb