Sha256: 698d273a2342e37e1c4b248f68935b2a4fc64a540b91ec6a29952311c3272e95

Contents?: true

Size: 666 Bytes

Versions: 9

Compression:

Stored size: 666 Bytes

Contents

module Praxis

  module PluginConcern
    extend ::ActiveSupport::Concern

    included do
      @setup = false
    end

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

      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

9 entries across 9 versions & 1 rubygems

Version Path
praxis-0.19.0 lib/praxis/plugin_concern.rb
praxis-0.18.1 lib/praxis/plugin_concern.rb
praxis-0.18.0 lib/praxis/plugin_concern.rb
praxis-0.17.1 lib/praxis/plugin_concern.rb
praxis-0.17.0 lib/praxis/plugin_concern.rb
praxis-0.16.1 lib/praxis/plugin_concern.rb
praxis-0.16.0 lib/praxis/plugin_concern.rb
praxis-0.15.0 lib/praxis/plugin_concern.rb
praxis-0.14.0 lib/praxis/plugin_concern.rb