Sha256: 6755e30056f8e496bd7bb28249ea76f4e3011f6f4415861b5f2764486d191c96
Contents?: true
Size: 557 Bytes
Versions: 12
Compression:
Stored size: 557 Bytes
Contents
require 'dry-validation' schema = Dry::Validation.Schema do configure do def self.messages super.merge(en: { errors: { john_email?: '%{value} is not a john email', example_email?: '%{value} is not a example email' } }) end end required(:email).filled validate(example_email?: :email) do |value| value.end_with?('@example.com') end validate(john_email?: :email) do |value| value.start_with?('john') end end errors = schema.call(email: 'jane@doe.org').messages puts errors.inspect
Version data entries
12 entries across 12 versions & 1 rubygems