Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Dec 07 14:03

    dry-bot on master

    [devtools] config sync (compare)

  • Dec 07 10:01
    Travis dry-rb/dry-view (master) errored (636)
  • Dec 07 09:58
    Travis dry-rb/dry-view (master) errored (635)
  • Dec 07 09:56

    dry-bot on master

    [devtools] config sync (compare)

  • Dec 07 09:56

    dry-bot on master

    [devtools] config sync (compare)

  • Dec 07 09:56

    dry-bot on master

    [devtools] config sync (compare)

  • Dec 07 09:56

    dry-bot on master

    [devtools] config sync (compare)

  • Dec 07 09:56

    dry-bot on master

    [devtools] config sync (compare)

  • Dec 07 09:56

    dry-bot on master

    [devtools] config sync (compare)

  • Dec 07 09:56

    dry-bot on master

    [devtools] config sync (compare)

  • Dec 07 09:56

    dry-bot on master

    [devtools] config sync (compare)

  • Dec 07 09:56

    dry-bot on master

    [devtools] config sync (compare)

  • Dec 07 09:56

    dry-bot on master

    [devtools] config sync (compare)

  • Dec 07 09:56

    dry-bot on master

    [devtools] config sync (compare)

  • Dec 07 09:56

    dry-bot on master

    [devtools] config sync (compare)

  • Dec 07 09:54

    dry-bot on master

    [devtools] config sync (compare)

  • Dec 07 09:54

    dry-bot on master

    [devtools] config sync (compare)

  • Dec 07 09:54

    dry-bot on master

    [devtools] config sync (compare)

  • Dec 07 09:54

    dry-bot on master

    [devtools] config sync (compare)

  • Dec 07 09:54

    dry-bot on master

    [devtools] config sync (compare)

John Backus
@backus
Alrighty. I can't speak for the dry-rb organization since I'm not a core contributor but I'd recommend not venting in gitter/in a public forum with contributors. As far as I know everyone contributing to dry-rb things is doing so for free.
Kimmo Lehto
@kke
yes and the gems are quite nice.
John Backus
@backus
Glad you like them :smile:
Christopher Dennl-Ortega Arrieta
@cdennl

@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>'
Nikita Shilnikov
@flash-gordon
@kke we had some issues with 2.0 support regarding required kw arguments and a few others. Since it's now EOL, we started to remove it from Travis configs, therefore we can't guarantee everything will work on 2.0. It's better to get a meaningful error about version incompatibility, than have a weird SyntaxError exception
also, imo, it's not a good idea to have relaxed dependencies when you're using ruby 2.0, I have Gemfile.lock in all of my commercial projects, this way I can be sure I'll have the same environment on every deploy
and, after all, upgrading to a fresher ruby version shouldn't be hard, it's pretty stable nowadays
Christopher Dennl-Ortega Arrieta
@cdennl
@solnic solved it doesn't seem to be a dry-v error
@solnic seems to be reform ill investigate further
Christopher Dennl-Ortega Arrieta
@cdennl
@solnic investigation yielded (like so often): own dumbness, I used ! (not), ... which is wrong :D
Michał Gutowski
@CucumisSativus

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?

Nikita Shilnikov
@flash-gordon
@CucumisSativus value combining will be probably added in future, but right now you can just do validate.bind instead of validate.fmap, this will give the result you want
Michał Gutowski
@CucumisSativus
@flash-gordon yeah that's exactly what i was looking for. Thanks a lot!
Nikita Shilnikov
@flash-gordon
np :)
Michał Gutowski
@CucumisSativus
@flash-gordon would you mind if I put your name (site?) in special thanks in my blogpost?
Nikita Shilnikov
@flash-gordon
@CucumisSativus I would not :) I don't have a site, you can add a gh link or twitter if you wish https://twitter.com/NikitaShilnikov
oh, well, that preview again
Michał Gutowski
@CucumisSativus
i'll let you know once I publish it :)
Jānis Miezītis
@janjiss
Hey folks, how would one deep copy Dry Container instance? :)
I want inherited object to have container with same values:
    def inherited(subclass)
      subclass.instance_variable_set(:"@container", Marshal.load(Marshal.dump(_container)))
    end
It works this way, just woundering if there is a better way to do it
Jānis Miezītis
@janjiss
Well, I think this is better:
    def inherited(subclass)
      subclass_container = Dry::Container.new
      _container.each_key do |k|
        subclass_container.register(k, _container.resolve(k).clone)
      end
      subclass.instance_variable_set(:"@container", subclass_container)
    end
Don Morrison
@elskwid
@janjiss my experience with Marshal.load and Marhsal.dump has led me to this wisdom: don’t use them. I’ve seen the formats change on Ruby point releases. Not fun. That second one is better even if just for the ability to withstand an upgrade. :smile:
Jānis Miezītis
@janjiss
@elskwid Yeah, I can se how that can become a problem
Piotr Solnica
@solnic
Yes. I wouldn't rely on marshaling
Mikhail Slyusarev
@mikhailvs
do you guys actually use dry-rb in production?
John Backus
@backus
We do
dry-validation and dry-types
works great
Mikhail Slyusarev
@mikhailvs
hmm... i've refactored a pretty big app to use dry-containers/validation/transactions but i'm feeling a bit reluctant to pull the trigger on deploying it
either way. it seems like a very cool collection of libraries
John Backus
@backus
If you have good tests I think you should be safe although I can't vouch for containers and transactions
just lock yourself to a strict version
Mikhail Slyusarev
@mikhailvs
yeah... for sure
Piotr Solnica
@solnic
@mikhailvs what’s your concern?
Mikhail Slyusarev
@mikhailvs
Honestly, I've only very recently stumbled upon dry-rb, and it's hard to gauge how widely it's being used. I suppose it's not a real concern though, more like curiousity.
Piotr Solnica
@solnic
@mikhailvs it’s used on production by many people
it is unstable though, so APIs may change from time to time until we hit 1.0.0
Mikhail Slyusarev
@mikhailvs
Is there a way to set a message for a custom dry-validation predicate without loading a yaml file?
Piotr Solnica
@solnic
not yet
I mean…it is possible to merge in your own messages
Mikhail Slyusarev
@mikhailvs
is that not recommended/
what you linked to actually seems like a pretty sane way of doing that
Piotr Solnica
@solnic
well, I don’t like it but it doesn’t mean it’s not recommended. personally I dislike having core objects of my system cluttered with UI-related configurations
Mikhail Slyusarev
@mikhailvs
I can see that. I'd still feel like there's UI stuff polluting backend code with a yaml conf file though... especially with api driven apps.
Piotr Solnica
@solnic
how come? that’s a nice separation, just like you separate html templates from objects that provide data for rendering, it’s somewhat similar here
Mikhail Slyusarev
@mikhailvs
I mean it's stuff that shows up on the frontend, being defined in files of the backend project.
Piotr Solnica
@solnic
you could render them on the client side and have message templates defined there
Mikhail Slyusarev
@mikhailvs
I'm not saying I have a different/better approach though. But it seems like the kind of error something is, is coupled with the text description of it, and since the error is generated on the backend, it's fine for other components of it to be defined there as well.