solnic on v0.9.0
dry-bot on master
[devtools] sync (compare)
solnic on master
Update changelog.yml Bump dry-matcher to 0.9.0 (compare)
dry-bot on master
[devtools] update changelog.yml… [devtools] sync (compare)
solnic on master
Turn evaluator into an Object d… Merge pull request #32 from dry… (compare)
timriley on add-0-19-0-changelog
Add changelog entry for 0.19.0 (compare)
timriley on add-0-19-0-changelog
Add changelog entry for 0.19.0 (compare)
rule( check_comment_on_reject: [ :is_accepted, :comment ] ) do |is_accepted, comment|
is_accepted.false? > comment.filled?
end
in `block (3 levels) in <class:CreateSubmissionReview>': undefined method `then' for false:FalseClass (NoMethodError)
from /usr/local/rvm/gems/ruby-2.3.1/gems/dry-validation-0.9.5/lib/dry/validation/schema/value.rb:95:in `instance_exec'
from /usr/local/rvm/gems/ruby-2.3.1/gems/dry-validation-0.9.5/lib/dry/validation/schema/value.rb:95:in `rule'
required( :user ).filled
required( :challenge ).filled( :is_opened?, :is_in_review_time_frame? )
required( :participation ).filled( :has_video_submission? )
rule( check_self_review: [ :user, :challenge, :participation ] ) do |user, challenge, participation|
( !user.is_host?( challenge ) & user.is_participant?( challenge ) ).then( user.does_no_self_review?( participation ) )
end
/usr/local/rvm/gems/ruby-2.3.1/gems/dry-validation-0.9.5/lib/dry/validation/schema/value.rb:98:in `rule': undefined method `with' for true:TrueClass (NoMethodError)
from /var/www/gamebet/app/concepts/submission_review/operation/create.rb:49:in `block (2 levels) in <class:Create>'
from /usr/local/rvm/gems/ruby-2.3.1/gems/dry-validation-0.9.5/lib/dry/validation/schema/class_interface.rb:46:in `instance_exec'
from /usr/local/rvm/gems/ruby-2.3.1/gems/dry-validation-0.9.5/lib/dry/validation/schema/class_interface.rb:46:in `define'
@solnic I am trying to make a little standalone script but when i try to execute this:
require 'dry/validation/schema'
schema = Dry::Validation.Schema do
required( :is_accepted ).filled( :bool? )
optional( :comment ).maybe( :str?, size?: (5..2000) )
rule( check_comment_on_reject: [ :is_accepted, :comment ] ) do |is_accepted, comment|
is_accepted.false? > comment.filled?
end
end
schema.( is_accepted: false, comment: nil ).inspect
I get this error:
christopher@debian-vm:~$ ruby dry-v.rb
/usr/local/rvm/gems/ruby-2.3.1/gems/dry-logic-0.3.0/lib/dry/logic/predicate.rb:19:in `<class:Predicate>': undefined method `Equalizer' for Dry:Module (NoMethodError)
Did you mean? equal?
from /usr/local/rvm/gems/ruby-2.3.1/gems/dry-logic-0.3.0/lib/dry/logic/predicate.rb:11:in `<module:Logic>'
from /usr/local/rvm/gems/ruby-2.3.1/gems/dry-logic-0.3.0/lib/dry/logic/predicate.rb:2:in `<module:Dry>'
from /usr/local/rvm/gems/ruby-2.3.1/gems/dry-logic-0.3.0/lib/dry/logic/predicate.rb:1:in `<top (required)>'
from /usr/local/rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:68:in `require'
from /usr/local/rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:68:in `require'
from /usr/local/rvm/gems/ruby-2.3.1/gems/dry-logic-0.3.0/lib/dry/logic/predicate_set.rb:1:in `<top (required)>'
from /usr/local/rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:68:in `require'
from /usr/local/rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:68:in `require'
from /usr/local/rvm/gems/ruby-2.3.1/gems/dry-logic-0.3.0/lib/dry/logic/predicates.rb:5:in `<top (required)>'
from /usr/local/rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:68:in `require'
from /usr/local/rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:68:in `require'
from /usr/local/rvm/gems/ruby-2.3.1/gems/dry-validation-0.9.5/lib/dry/validation/schema.rb:1:in `<top (required)>'
from /usr/local/rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:127:in `require'
from /usr/local/rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:127:in `rescue in require'
from /usr/local/rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:40:in `require'
from dry-v.rb:1:in `<main>'
Hey guys i'm pretty fresh to dry monads and i've got a question about fmap
. Lets suppose i've got code like this:
validate.fmap do |valid_attributes|
form.save.fmap do |valid_postcard|
mailer.send_postcard(to_email: email, postcard: valid_postcard).deliver_now
valid_postcard
end
end
both validate
and form.save
returns Left
or Right
. Is there a way to chain both those functions so they return Left
or Right
at the end of the chain? Now, when form.save
returns Left at the end of the day I have Right(Left(errors))
.
Am I doing something wrong? Is there a way to make it chainable?
def inherited(subclass)
subclass.instance_variable_set(:"@container", Marshal.load(Marshal.dump(_container)))
end