Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Jun 24 23:59
    timriley synchronize #236
  • Jun 24 23:59

    timriley on nil-import-namespaces

    Import root components via `nil… Rename spec (compare)

  • Jun 24 05:18

    timriley on add-file-path-to-component

    (compare)

  • Jun 24 05:18

    timriley on main

    Expose Component#file_name Thi… Merge pull request #237 from dr… (compare)

  • Jun 24 05:18
    timriley closed #237
  • Jun 24 00:41
    timriley edited #239
  • Jun 24 00:40
    timriley unlabeled #239
  • Jun 24 00:40
    timriley unlabeled #239
  • Jun 24 00:40
    timriley labeled #239
  • Jun 24 00:40
    timriley labeled #239
  • Jun 24 00:40
    timriley opened #239
  • Jun 23 12:20
    timriley unlabeled #238
  • Jun 23 12:19
    timriley labeled #238
  • Jun 23 12:19
    timriley labeled #238
  • Jun 23 12:19
    timriley opened #238
  • Jun 23 11:24
    timriley review_requested #237
  • Jun 23 11:24
    timriley review_requested #237
  • Jun 23 11:24
    timriley opened #237
  • Jun 23 11:24

    timriley on add-file-path-to-component

    Expose Component#file_name Thi… (compare)

  • Jun 23 10:33
    timriley synchronize #236
Shawn Anderson
@shawn42
what I'm shooting for is: something like M::List::Validated[M::Success(1), M::Failure("boom 2")].typed(M::Result).traverse => Failure(List<Result>["boom 1", "boom2"])
Philip Arndt
@parndt

Hey folks, we've been testing Zulip as a Gitter replacement for the last few days. So far it feels really great and we'd like more people to sign up and check it out. We did not decide yet if we want to switch but it's likely that we will, because of this please sign up and let's chat there whether you like it or not.

You can sign up right here: https://dry-rb.zulipchat.com/register/

If you haven't heard about Zulip, it's an OSS communication platform. Something between a chat and email, with a unique communication model based on streams and topics. The company behind it was acquired by Dropbox, but they open sourced the project back in 2015. Its development is very active and it looks promising in general.

Check out Why Zulip here: https://zulipchat.com/why-zulip/

you could try Zulip @shawn42 ^

Shawn Anderson
@shawn42
Thanks @parndt I'll check it out
Philip Arndt
@parndt
gitter's being super janky for me too
Piotr Solnica
@solnic
yes, especially that Gitter is acting WEIRD lately
Nikita Shilnikov
@flash-gordon
Yeah, that’d be the best way :)
Piotr Solnica
@solnic
like messages from @shawn42 are disappearing for me, then re-appearing but in a different order lol
Shawn Anderson
@shawn42
so zulip is kind of a google wave rebirth? ;)
also, now that you are all here.. any ideas on the best way to collect my failures using a list monad? or is that not the correct usage?
Jeff Dickey
@jdickey
That's really odd, @solnic . I live in Gitter most of the day (20+ open channels, more than half of those active on a given day) and I've never seen that happen. Not disbelieving; just wondering if it's a geographic/network backbone thing somehow
Piotr Solnica
@solnic
@jdickey I had a lot of issues like that but today is exceptionally bad
Jeff Dickey
@jdickey
That is weird. My gripe is that development seems to have basically stopped; they had a Version 2 that had some much-needed new features and bug fixes out for a while a year and a half ago or so, and then they yanked it and everybody's on 1.177 from 2016. If there's a better-maintained/more solid app out there, I'm open to the thought
Piotr Solnica
@solnic
@jdickey we're switching to Zulip
Jeff Dickey
@jdickey
Understoon
Piotr Solnica
@solnic
we also tried Slack, Rocket, Discord and Spectrum
eventually it turned out Zulip is the best option
Piotr Solnica
@solnic

@/all hey, after 2 weeks of testing we decided to switch to Zulip and we are saying "good bye" to Gitter. From April 1st (no kidding) we'll be hanging out in Zulip and stop paying attention to this Gitter chat. You can join our Zulip organization here: https://dry-rb.zulipchat.com/register/

ps. rom-rb gitter chat will move too

Philip Arndt
@parndt
:tada:
Brice Sanchez
@bricesanchez
:tada:
Orban Botond
@orbanbotond

Hi Guys,

How can I use succesfully the inheritance in dry-rb transactions?

Here is the code which shows that it just doens’t work:

require 'spec_helper'

module CRUD
  class Update
    include Dry::Transaction

    step :validate
    step :persist


    def validate(input)
      Success(input.to_s + model_class.to_s)
    end

    def persist(input)
      Success(input.to_s + model_class.to_s)
    end
  end

  class ORMModel1
  end

  class Update1 < Update
    def model_class
      ORMModel1
    end
  end
end

describe 'ParamOverride' do
  context 'update1' do
    subject { CRUD::Update1.new.call params }
    let(:params) { {a:1,b:2} }

    context 'negative cases' do
      specify 'inheritance just does not work' do
        expect(subject).to be_success
        expect(subject.value!).to_not eq('{}ORMModel1')
      end
    end
  end
end
Viet (Drake) Tran
@tiev
What is the output? Btw, can you move to zulipchat? This gitter is abandoned
Orban Botond
@orbanbotond
@tiev I expected the output to be '{}ORMModel1’
Viet (Drake) Tran
@tiev
And I guess the actual output is '{:a=>1, :b=>2}ORMModel1ORMModel1'
Orban Botond
@orbanbotond
@tiev no, the actual output is {:a=>1, :b=>2}
Lairan
@alex-lairan

@/all hey, after 2 weeks of testing we decided to switch to Zulip and we are saying "good bye" to Gitter. From April 1st (no kidding) we'll be hanging out in Zulip and stop paying attention to this Gitter chat. You can join our Zulip organization here: https://dry-rb.zulipchat.com/register/

ps. rom-rb gitter chat will move too

Sergey Kukunin
@Kukunin
Hi guys. I want to serialize/deserialize my dry-struct to JSON. Is there a way to derive a new dry-struct which can build an original from JSON? I expect it to convert all types to their JSON equivalents
I expect it to work recursively
Lairan
@alex-lairan
Please, read my last message :)
Martín Fernández
@bilby91
Hello! I’m looking into dry-validations 1.X and I was wondering if there is any way to compose multiple contracts, basically delegate the validation of a given property from within a contract to another contract.
Tonni Tølbøll Lund Aagesen
@ta
2.5.3p105> require "dry-types"
=> true
2.5.3p105> include Dry.Types()
=> Object
2.5.3p105> Params::Integer["1"]
=> 1
2.5.3p105> Params::Integer[1]
=> 1
2.5.3p105> Params::Time["2019-11-26 15:50:12 +0000"]
=> 2019-11-26 15:50:12 +0000
2.5.3p105> Params::Time[Time.new]
Traceback (most recent call last):
       16: from /var/lib/gems/2.5.0/gems/bundler-1.15.4/lib/bundler/cli.rb:13:in `start'
       15: from /var/lib/gems/2.5.0/gems/bundler-1.15.4/lib/bundler/vendor/thor/lib/thor/base.rb:466:in `start'
       14: from /var/lib/gems/2.5.0/gems/bundler-1.15.4/lib/bundler/cli.rb:22:in `dispatch'
       13: from /var/lib/gems/2.5.0/gems/bundler-1.15.4/lib/bundler/vendor/thor/lib/thor.rb:387:in `dispatch'
       12: from /var/lib/gems/2.5.0/gems/bundler-1.15.4/lib/bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command'
       11: from /var/lib/gems/2.5.0/gems/bundler-1.15.4/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
       10: from /var/lib/gems/2.5.0/gems/bundler-1.15.4/lib/bundler/cli.rb:362:in `exec'
        9: from /var/lib/gems/2.5.0/gems/bundler-1.15.4/lib/bundler/cli/exec.rb:27:in `run'
        8: from /var/lib/gems/2.5.0/gems/bundler-1.15.4/lib/bundler/cli/exec.rb:74:in `kernel_load'
        7: from /var/lib/gems/2.5.0/gems/bundler-1.15.4/lib/bundler/cli/exec.rb:74:in `load'
        6: from /usr/bin/irb:11:in `<top (required)>'
        5: from (irb):6
        4: from /var/bundler/gems/dry-types-1.2.1/lib/dry/types/type.rb:49:in `call'
        3: from /var/bundler/gems/dry-types-1.2.1/lib/dry/types/constructor.rb:59:in `call_unsafe'
        2: from /var/bundler/gems/dry-types-1.2.1/lib/dry/types/constructor/function.rb:61:in `call'
        1: from /var/bundler/gems/dry-types-1.2.1/lib/dry/types/coercions.rb:87:in `to_time'
Dry::Types::CoercionError (2019-11-26 16:16:50 +0000 is not a string)
Is it on purpose that Param::Time[] no longer accepts a Time object?
I would expect coerce to do something like obj.class == Time ? obj : coerce(obj, Time)
Tonni Tølbøll Lund Aagesen
@ta
This was also the case in previous versions, I believe
Tonni Tølbøll Lund Aagesen
@ta
In dry-validation 0.12.2.. which I admit is pretty old ;)
Grant Shangreaux
@gcentauri
@ta dry isn't here anymore, its on zulip now https://dry-rb.zulipchat.com/register/
Tonni Tølbøll Lund Aagesen
@ta
oh, thanks
Sam Stickland
@samstickland
I'm struggling with the documentation.. how can I make this work in dry-types 1.2.x ? It's using an older syntax:
  module Types
    include Dry::Types(default: :nominal)

    CompactArray = Types::Coercible::Array.constructor { |vs| vs.map(&:presence).compact.map }

    SplittingCompactArray = Types::Coercible::Array.constructor do |vs|
      vs
        .flat_map { |v| v.is_a?(::String) ? v.split(',') : v }
        .map(&:presence)
        .compact
        .map
    end
  end
Grant Shangreaux
@gcentauri
@samstickland chat has moved to zulip https://dry-rb.zulipchat.com/
Alex Hayes
@alexhayes
Are there any docs regarding the differences between Types::JSON::DateTime and Types::JSON::Time and when you should use one over the other?
Grant Shangreaux
@gcentauri
@alexhayes this chat is dead. check the the topic, it moved to zulip
Alex Hayes
@alexhayes
Thanks Grant, I realised that after I posted.
Lenart Rudel
@lenart

Hey guys, I'm trying to wrap my head around the difference between

  optional(:age).filled(:integer, gt?: 18)
  optional(:age).maybe(:integer, gt?: 18)

To me this reads that age is optional in both cases and that when the value is present it should be typecasted as integer and be greater than 18. I Feels like the two statements are identical - or am I missing something?

Seb Wilgosz
@swilgosz

@lenart the latter one allows to pass NIL:

contract = MyContract.new
contract.call(age: nil, age2:nil)
#<Dry::Validation::Result{:age=>nil, :age2=>nil} errors={:age=>["must be filled"]}>

The optional keyword allows you to completely SKIP the key, so it would be valid for validator.call({}) because you can omit both of them. But if you pass any value, only one can be nil, and the other one needs to be present and castable to Integer.

Chau Duc Tai
@taigroddy
Hello guys,
Im using Dry::Transaction
May I can inherit?
For ex:
  • class ApplicationService
            include Dry::Transaction
  • class AdminService << ApplicationService (step :validation, step :check_active, step :privileges { another processing } )
  • class UserService << AdminService (step :validation, step :check_active, step :privileges { another processing })
I always have to repeat 3 steps
Chau Duc Tai
@taigroddy
like this:
   class AdminService << ApplicationService
         step :validation
         step :check_active
         step :privileges

        def validation; end
       def check_active; end
       def privileges; and
  end
    class UserService << AdminService
         step :validation
         step :check_active
         step :privileges

       def privileges; and
   end
could I only need to do
class UserService << AdminService
   def privileges; and
end