Sha256: 2b0c7cde496a09343def56b780709007496777c1400d0d858d27c048c6aaebeb

Contents?: true

Size: 965 Bytes

Versions: 17

Compression:

Stored size: 965 Bytes

Contents

# frozen_string_literal: true

require "dry/configurable"

module Hanami
  class Config
    # Hanami router config
    #
    # @since 2.0.0
    # @api private
    class Router
      include Dry::Configurable

      # Base config is provided so router config can include the `base_url`
      attr_reader :base_config
      private :base_config

      # @api private
      # @since 2.0.0
      def initialize(base_config)
        @base_config = base_config
      end

      setting :resolver, default: Slice::Routing::Resolver

      # @api private
      # @since 2.0.0
      def options
        {base_url: base_config.base_url}
      end

      private

      def method_missing(name, *args, &block)
        if config.respond_to?(name)
          config.public_send(name, *args, &block)
        else
          super
        end
      end

      def respond_to_missing?(name, _include_all = false)
        config.respond_to?(name) || super
      end
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
hanami-2.2.1 lib/hanami/config/router.rb
hanami-2.2.0 lib/hanami/config/router.rb
hanami-2.2.0.rc1 lib/hanami/config/router.rb
hanami-2.2.0.beta2 lib/hanami/config/router.rb
hanami-2.2.0.beta1 lib/hanami/config/router.rb
hanami-2.1.0 lib/hanami/config/router.rb
hanami-2.1.0.rc3 lib/hanami/config/router.rb
hanami-2.1.0.rc2 lib/hanami/config/router.rb
hanami-2.1.0.rc1 lib/hanami/config/router.rb
hanami-2.1.0.beta2.1 lib/hanami/config/router.rb
hanami-2.1.0.beta2 lib/hanami/config/router.rb
hanami-2.1.0.beta1 lib/hanami/config/router.rb
hanami-2.0.3 lib/hanami/config/router.rb
hanami-2.0.2 lib/hanami/config/router.rb
hanami-2.0.1 lib/hanami/config/router.rb
hanami-2.0.0 lib/hanami/config/router.rb
hanami-2.0.0.rc1 lib/hanami/config/router.rb