Sha256: e17961a958128f106de0164fd4ab7cb8bd8d076e17e4560e1a700af4319a4e21

Contents?: true

Size: 691 Bytes

Versions: 9

Compression:

Stored size: 691 Bytes

Contents

module Praxis

  module PluginConcern
    extend ::ActiveSupport::Concern

    included do
      @setup = false
    end

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

      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-2.0.pre.18 lib/praxis/plugin_concern.rb
praxis-2.0.pre.17 lib/praxis/plugin_concern.rb
praxis-2.0.pre.16 lib/praxis/plugin_concern.rb
praxis-2.0.pre.15 lib/praxis/plugin_concern.rb
praxis-2.0.pre.14 lib/praxis/plugin_concern.rb
praxis-2.0.pre.13 lib/praxis/plugin_concern.rb
praxis-2.0.pre.12 lib/praxis/plugin_concern.rb
praxis-2.0.pre.11 lib/praxis/plugin_concern.rb
praxis-2.0.pre.10 lib/praxis/plugin_concern.rb