Sha256: 2ba69f925c8dd1361f388c801316d97a4654c1eadf61bb0f682e6ea5a601b750

Contents?: true

Size: 1.03 KB

Versions: 20

Compression:

Stored size: 1.03 KB

Contents

require 'hanami/utils/class_attribute'

module Hanami
  module Action
    # Configuration API
    #
    # @since 0.2.0
    #
    # @see Hanami::Controller::Configuration
    module Configurable
      # Override Ruby's hook for modules.
      # It includes configuration logic
      #
      # @param base [Class] the target action
      #
      # @since 0.2.0
      # @api private
      #
      # @see http://www.ruby-doc.org/core-2.1.2/Module.html#method-i-included
      #
      # @example
      #   require 'hanami/controller'
      #
      #   class Show
      #     include Hanami::Action
      #   end
      #
      #   Show.configuration
      def self.included(base)
        config = Hanami::Controller::Configuration.for(base)

        base.class_eval do
          include Utils::ClassAttribute

          class_attribute :configuration
          self.configuration = config
        end

        config.copy!(base)
      end

      private

      # @since 0.2.0
      def configuration
        self.class.configuration
      end
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
hanami-controller-1.3.3 lib/hanami/action/configurable.rb
hanami-controller-1.3.2 lib/hanami/action/configurable.rb
hanami-controller-1.3.1 lib/hanami/action/configurable.rb
hanami-controller-1.3.0 lib/hanami/action/configurable.rb
hanami-controller-1.3.0.beta1 lib/hanami/action/configurable.rb
hanami-controller-1.2.0 lib/hanami/action/configurable.rb
hanami-controller-1.2.0.rc2 lib/hanami/action/configurable.rb
hanami-controller-1.2.0.rc1 lib/hanami/action/configurable.rb
hanami-controller-1.2.0.beta2 lib/hanami/action/configurable.rb
hanami-controller-1.2.0.beta1 lib/hanami/action/configurable.rb
hanami-controller-1.1.1 lib/hanami/action/configurable.rb
hanami-controller-1.1.0 lib/hanami/action/configurable.rb
hanami-controller-1.1.0.rc1 lib/hanami/action/configurable.rb
hanami-controller-1.1.0.beta3 lib/hanami/action/configurable.rb
hanami-controller-1.1.0.beta2 lib/hanami/action/configurable.rb
hanami-controller-1.1.0.beta1 lib/hanami/action/configurable.rb
hanami-controller-1.0.1 lib/hanami/action/configurable.rb
hanami-controller-1.0.0 lib/hanami/action/configurable.rb
hanami-controller-1.0.0.rc1 lib/hanami/action/configurable.rb
hanami-controller-1.0.0.beta3 lib/hanami/action/configurable.rb