Sha256: 7dddfb1b50a340ce692af8e9ae3e8a49bcebda49799645bbc5eaaaf31f27dae5

Contents?: true

Size: 1018 Bytes

Versions: 1

Compression:

Stored size: 1018 Bytes

Contents

# frozen_string_literal: true

require "dry/configurable"

module Hanami
  module Assets
    # @since 2.0.0
    # @api public
    class Config
      include Dry::Configurable

      # Initialize the Config
      #
      # @yield [config] the config object
      #
      # @return [Config]
      #
      # @since 2.0.0
      # @api private
      def initialize(*)
        super
        yield self if block_given?
      end

      # Returns the list of available settings
      #
      # @return [Set]
      #
      # @since 2.0.0
      # @api private
      def settings
        self.class.settings
      end

      private

      # @since 2.0.0
      # @api private
      def method_missing(name, *args, &block)
        if config.respond_to?(name)
          config.public_send(name, *args, &block)
        else
          super
        end
      end

      # @since 2.0.0
      # @api private
      def respond_to_missing?(name, _incude_all = false)
        config.respond_to?(name) || super
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
hanami-2.0.0.beta4 lib/hanami/assets/config.rb