Sha256: af03b6b891de37fc2e9e05e836c593d89f283c785a31984e3222896c06da53cd
Contents?: true
Size: 917 Bytes
Versions: 12
Compression:
Stored size: 917 Bytes
Contents
module Foobara module BuiltinTypes module Duck module SupportedValidators class OneOf < TypeDeclarations::Validator class ValueNotValidError < Foobara::Value::DataError class << self def context_type_declaration { value: :duck, valid_values: [:duck] } end end end def valid_values declaration_data end def validation_errors(value) unless valid_values.include?(value) build_error(value) end end def error_message(value) "#{value} is not one of #{valid_values}" end def error_context(value) { value:, valid_values: } end end end end end end
Version data entries
12 entries across 12 versions & 1 rubygems