Sha256: aae51478a5eb27a02a84350f49cb2c083af3d6d792d371c3eebae3982ee383bf

Contents?: true

Size: 675 Bytes

Versions: 4

Compression:

Stored size: 675 Bytes

Contents

# frozen_string_literal: true

require 'pathname'
require 'dry/core/constants'

module Dry
  module Schema
    include Core::Constants

    LIST_SEPARATOR = ', '
    QUESTION_MARK = '?'
    DOT = '.'

    DEFAULT_MESSAGES_PATH = Pathname(__dir__).join('../../../config/errors.yml').realpath.freeze
    DEFAULT_MESSAGES_ROOT = 'dry_schema'

    InvalidSchemaError = Class.new(StandardError)

    MissingMessageError = Class.new(StandardError) do
      # @api private
      def initialize(path)
        *rest, rule = path
        super(<<~STR)
          Message template for #{rule.inspect} under #{rest.join(DOT).inspect} was not found
        STR
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
dry-schema-0.6.0 lib/dry/schema/constants.rb
dry-schema-0.5.1 lib/dry/schema/constants.rb
dry-schema-0.5.0 lib/dry/schema/constants.rb
dry-schema-0.4.0 lib/dry/schema/constants.rb