Sha256: 9286c5ae1a60102cbc8d92dcdc8ee077749ad60035410b9ab8f3d1bc64d95d22
Contents?: true
Size: 1.45 KB
Versions: 6
Compression:
Stored size: 1.45 KB
Contents
module Dry module Types extend Dry::Configurable # @!attribute [r] namespace # @return [Container{String => Definition}] setting :namespace, self class SchemaError < TypeError # @param [String,Symbol] key # @param [Object] value # @param [String, #to_s] result def initialize(key, value, result) super("#{value.inspect} (#{value.class}) has invalid type for :#{key} violates constraints (#{result} failed)") end end SchemaKeyError = Class.new(KeyError) private_constant(:SchemaKeyError) class MissingKeyError < SchemaKeyError # @param [String,Symbol] key def initialize(key) super(":#{key} is missing in Hash input") end end class UnknownKeysError < SchemaKeyError # @param [<String, Symbol>] keys def initialize(*keys) super("unexpected keys #{keys.inspect} in Hash input") end end class ConstraintError < TypeError # @return [String, #to_s] attr_reader :result # @return [Object] attr_reader :input # @param [String, #to_s] result # @param [Object] input def initialize(result, input) @result = result @input = input if result.is_a?(String) super(result) else super(to_s) end end # @return [String] def to_s "#{input.inspect} violates constraints (#{result} failed)" end end end end
Version data entries
6 entries across 6 versions & 1 rubygems