Skip to content

Instantly share code, notes, and snippets.

@kwando

kwando/Gemfile Secret

Created March 10, 2016 08:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kwando/d8ad54d98acc0c6ca7c7 to your computer and use it in GitHub Desktop.
Save kwando/d8ad54d98acc0c6ca7c7 to your computer and use it in GitHub Desktop.
require 'bundler'
Bundler.setup
require 'dry-validation'
schema = Dry::Validation.Schema do
key(:email).required
key(:age).required(:int?, gt?: 18)
end
errors = schema.call(email: 'jane@doe.org', age: 19).messages
puts errors.inspect
errors = schema.call(email: nil, age: 19).messages
puts errors.inspect
source "https://rubygems.org"
gem 'dry-types', github: 'dryrb/dry-types'
gem 'dry-validation', github: 'dryrb/dry-validation'
/Users/kwando/.rbenv/versions/2.3.0/bin/ruby -e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift) /Users/kwando/projects/dry-v-playground/main.rb
/Users/kwando/projects/dry-v-playground/vendor/bundle/gems/dry-logic-0.1.4/lib/dry/logic/rule_compiler.rb:18:in `visit': undefined method `visit_type?' for #<Dry::Logic::RuleCompiler:0x007f818c0e1518> (NoMethodError)
Did you mean? visit_key
from /Users/kwando/projects/dry-v-playground/vendor/bundle/gems/dry-logic-0.1.4/lib/dry/logic/rule_compiler.rb:61:in `visit_val'
from /Users/kwando/projects/dry-v-playground/vendor/bundle/gems/dry-logic-0.1.4/lib/dry/logic/rule_compiler.rb:18:in `visit'
from /Users/kwando/projects/dry-v-playground/vendor/bundle/gems/dry-logic-0.1.4/lib/dry/logic/rule_compiler.rb:13:in `block in call'
from /Users/kwando/projects/dry-v-playground/vendor/bundle/gems/dry-logic-0.1.4/lib/dry/logic/rule_compiler.rb:13:in `map'
from /Users/kwando/projects/dry-v-playground/vendor/bundle/gems/dry-logic-0.1.4/lib/dry/logic/rule_compiler.rb:13:in `call'
from /Users/kwando/projects/dry-v-playground/vendor/bundle/bundler/gems/dry-types-4bb11f64230d/lib/dry/types/constraints.rb:15:in `Rule'
from /Users/kwando/projects/dry-v-playground/vendor/bundle/bundler/gems/dry-types-4bb11f64230d/lib/dry/types/builder.rb:13:in `constrained'
from /Users/kwando/projects/dry-v-playground/vendor/bundle/bundler/gems/dry-types-4bb11f64230d/lib/dry/types/core.rb:32:in `block in <module:Types>'
from /Users/kwando/projects/dry-v-playground/vendor/bundle/bundler/gems/dry-types-4bb11f64230d/lib/dry/types/core.rb:31:in `each'
from /Users/kwando/projects/dry-v-playground/vendor/bundle/bundler/gems/dry-types-4bb11f64230d/lib/dry/types/core.rb:31:in `<module:Types>'
from /Users/kwando/projects/dry-v-playground/vendor/bundle/bundler/gems/dry-types-4bb11f64230d/lib/dry/types/core.rb:2:in `<module:Dry>'
from /Users/kwando/projects/dry-v-playground/vendor/bundle/bundler/gems/dry-types-4bb11f64230d/lib/dry/types/core.rb:1:in `<top (required)>'
from /Users/kwando/projects/dry-v-playground/vendor/bundle/bundler/gems/dry-types-4bb11f64230d/lib/dry/types.rb:117:in `require'
from /Users/kwando/projects/dry-v-playground/vendor/bundle/bundler/gems/dry-types-4bb11f64230d/lib/dry/types.rb:117:in `<top (required)>'
from /Users/kwando/projects/dry-v-playground/vendor/bundle/bundler/gems/dry-validation-2044b44eff34/lib/dry/validation/input_type_compiler.rb:1:in `require'
from /Users/kwando/projects/dry-v-playground/vendor/bundle/bundler/gems/dry-validation-2044b44eff34/lib/dry/validation/input_type_compiler.rb:1:in `<top (required)>'
from /Users/kwando/projects/dry-v-playground/vendor/bundle/bundler/gems/dry-validation-2044b44eff34/lib/dry/validation/schema/form.rb:2:in `require'
from /Users/kwando/projects/dry-v-playground/vendor/bundle/bundler/gems/dry-validation-2044b44eff34/lib/dry/validation/schema/form.rb:2:in `<top (required)>'
from /Users/kwando/projects/dry-v-playground/vendor/bundle/bundler/gems/dry-validation-2044b44eff34/lib/dry/validation.rb:6:in `require'
from /Users/kwando/projects/dry-v-playground/vendor/bundle/bundler/gems/dry-validation-2044b44eff34/lib/dry/validation.rb:6:in `<top (required)>'
from /Users/kwando/projects/dry-v-playground/vendor/bundle/bundler/gems/dry-validation-2044b44eff34/lib/dry-validation.rb:1:in `require'
from /Users/kwando/projects/dry-v-playground/vendor/bundle/bundler/gems/dry-validation-2044b44eff34/lib/dry-validation.rb:1:in `<top (required)>'
from /Users/kwando/projects/dry-v-playground/main.rb:4:in `require'
from /Users/kwando/projects/dry-v-playground/main.rb:4:in `<top (required)>'
from -e:1:in `load'
from -e:1:in `<main>'
Process finished with exit code 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment