Sha256: e0385f67ab877ded465f341b50c66b478a3b6c78175d1e5456b045bdaaa40d90

Contents?: true

Size: 647 Bytes

Versions: 5

Compression:

Stored size: 647 Bytes

Contents

module Praxis

  module PluginConcern
    extend ::ActiveSupport::Concern

    included do
      @setup = false
    end

    module ClassMethods
      PLUGIN_CLASSES = [
        :Request,
        :Controller,
        :ResourceDefinition,
        :ActionDefinition
      ]

      def setup!
        return if @setup

        PLUGIN_CLASSES.each do |name|
          if self.constants.include?(name)
            inject!(name)
          end
        end

        @setup = true
      end

      def inject!(name)
        plugin = self.const_get(name)
        praxis = Praxis.const_get(name)

        praxis.include(plugin)
      end

    end
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
praxis-0.13.0 lib/praxis/plugin_concern.rb
praxis-0.11.2 lib/praxis/plugin_concern.rb
praxis-0.11.1 lib/praxis/plugin_concern.rb
praxis-0.11 lib/praxis/plugin_concern.rb
praxis-0.11pre lib/praxis/plugin_concern.rb