Sha256: a98d9fe76fcb06fcb6db369170ea1198b2febd75e811ae57604bf3a33328c7a3

Contents?: true

Size: 370 Bytes

Versions: 6

Compression:

Stored size: 370 Bytes

Contents

require 'dry-validation'

class Schema < Dry::Validation::Schema
  key(:phone_numbers) do |phone_numbers|
    phone_numbers.array? do
      phone_numbers.each(&:str?)
    end
  end
end

schema = Schema.new

errors = schema.call(phone_numbers: '').messages

puts errors.inspect

errors = schema.call(phone_numbers: ['123456789', 123456789]).messages

puts errors.inspect

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
dry-validation-0.6.0 examples/each.rb
dry-validation-0.5.0 examples/each.rb
dry-validation-0.4.1 examples/each.rb
dry-validation-0.4.0 examples/each.rb
dry-validation-0.3.1 examples/each.rb
dry-validation-0.3.0 examples/each.rb