Sha256: 9b3f0ee7c61da5d03cd25479d171849bb213884b12dd61d2c3d5eca2ee026b31

Contents?: true

Size: 1.06 KB

Versions: 2

Compression:

Stored size: 1.06 KB

Contents

# frozen_string_literal: true

require 'dry/core/constants'

module Dry
  module System
    include Dry::Core::Constants

    RB_EXT = '.rb'
    RB_GLOB = '*.rb'
    PATH_SEPARATOR = '/'
    DEFAULT_SEPARATOR = '.'
    WORD_REGEX = /\w+/.freeze

    DuplicatedComponentKeyError = Class.new(ArgumentError)
    InvalidSettingsError = Class.new(ArgumentError) do
      # @api private
      def initialize(attributes)
        message = <<~STR
          Could not initialize settings. The following settings were invalid:

          #{attributes_errors(attributes).join("\n")}
        STR
        super(message)
      end

      private

      def attributes_errors(attributes)
        attributes.map { |key, error| "#{key.name}: #{error}" }
      end
    end

    # Exception raise when a plugin dependency failed to load
    #
    # @api public
    PluginDependencyMissing = Class.new(StandardError) do
      # @api private
      def initialize(plugin, message)
        super("dry-system plugin #{plugin.inspect} failed to load its dependencies: #{message}")
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
dry-system-0.13.1 lib/dry/system/constants.rb
dry-system-0.13.0 lib/dry/system/constants.rb