Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Dec 03 17:32
    reedlaw starred dry-rb/dry-types
  • Dec 03 11:31
    timriley synchronize #155
  • Dec 03 11:31

    timriley on rich-component-dirs-config

    Clarify names Fixup naming Total messy WIP (compare)

  • Dec 02 22:38
    diegocasmo starred dry-rb/dry-initializer
  • Dec 02 17:58

    flash-gordon on wrapper-type

    Add wrapper type It's a POC of… (compare)

  • Dec 01 23:13
    hguerrerojaime synchronize #154
  • Dec 01 05:18
    timriley opened #155
  • Dec 01 05:10

    timriley on rich-component-dirs-config

    Fix wording of spec Add Rubocop rule Start getting component_dirs in… and 3 more (compare)

  • Nov 29 13:21
    flash-gordon commented #130
  • Nov 29 13:19
    flash-gordon commented #130
  • Nov 29 10:29
    bigsolom commented #87
  • Nov 29 07:42

    flash-gordon on master

    Add note about Do::All caveat … Merge pull request #134 from ma… (compare)

  • Nov 29 07:42
    flash-gordon closed #134
  • Nov 29 07:42
    flash-gordon commented #134
  • Nov 29 07:37
    flash-gordon closed #130
  • Nov 29 07:37
    flash-gordon commented #130
  • Nov 28 22:36

    dry-bot on master

    [devtools] sync (compare)

  • Nov 28 22:35

    flash-gordon on keep-method-visibility

    (compare)

  • Nov 28 22:35

    flash-gordon on master

    Add specs that demonstrate the … When wrapping methods, be expli… Visbility-preserving API for Do… and 3 more (compare)

Andy Holland
@AMHOL
@fran-worley had a second look and I'm not 100% sure that's the case now
So Range#include? should work I think?
Fran Worley
@fran-worley
I'll try it in my unreleased branch of Dry-V. If that works then it will be fixed when we can release dry logic on ruby gems.
I don't see that it will make much difference as I've not actually changed anything but the names really...
Simon Schmid
@sled
there's something interesting here:
```
  predicate(:included_in?) do |list, input|
    list.include?(input)
  end
  predicate(:includes?) do |value, input|
    input.include?(value)
  end
why are the arguments the other way around?
Fran Worley
@fran-worley
Yeah, that is not actually being used in DRY-V yet
dry-rb/dry-logic#9
the idea being: input_value.included_in?(list) vs input_value.includes?(value)
Simon Schmid
@sled
ah now I get it :)
Fran Worley
@fran-worley
so we had to rename inclusion? and exclusion? to make it clear what the 2 do
Fran Worley
@fran-worley
@panigrah try optional(:age).maybe(inclusion?: (1..5)) I've got it working when the range is wrapped in parentheses
Andrew Kozin
@nepalez

One more thing provided by @marshall-lee for initializer in our commercial project is the ar_param or ar_option.
It allows to set object dependency as either model or model id.

In Rails projects this proves to be very suitable (example below is over-simplified):

class DestroyUser
  ar_param :user

  def call
    user.destroy
  end

  def self.call(*args)
    new(*args).call
  end
end

user_id = 1
user = User.find 1

# This methods are the same
DestroyUser.call user_id
DestroyUser.call user

Under the hood the method either gets an activerecord instance or finds its by id (or by another argument):

ar_param :user, find_by: :key

The question is what do you think about implementing this behaviour in a submodule of dry-initializer (dry-initializer/rails)?

Andy Holland
@AMHOL
@nepalez wouldn't want something specifically targeting rails in a dry core gem, but I don't see any harm to add it as an external plugin, perhaps dry-initializer could benefit for some kind of plugin system anyway (assuming it doesn't have one already)
Andrew Kozin
@nepalez
@AMHOL well, for one feature I'd say plugin system to be an overkill, but maybe you're right
Andy Holland
@AMHOL
I think it makes sense to make it extendible, if there's this use case there will be more
Nikita Shilnikov
@flash-gordon
guys, I raised an issue about replacing kleisli with something else. Any thoughts are very welcome dry-rb/dry-types#80 :)
Tim Riley
@timriley
@nepalez yeah, I think explicit support of AR is outside of dry-rb's mission. So having another gem to add these methods in would seem better to me.
@flash-gordon I feel generally in favor of this. Will comment on the GH issue later on :)
panigrah
@panigrah
@fran-worley i get the same error NoMethodError (undefined methodjoin' for 1..5:Range):`
Fran Worley
@fran-worley
@panigrah I'll have a look tomorrow. I know it works with my updated predicates branch but it's not ready for release yet.
panigrah
@panigrah
thanks Fran! when do you all plan to release the new schema docs?
panigrah
@panigrah

is there a change to the rules api in master? I have this bit failing;

    rule(destiny: [:red, :blue]) do |red, blue|
        red.filled? | blue.filled?
    end

with:
schema/value.rb:82:inrule': undefined method with' for true:TrueClass (NoMethodError)

nilobject
@nil0bject

trying to use coercion. Why doesn’t

Types::Form::Bool['False']
=> "False"

return false?

:(
[17] pry(main)> LocalSearch::Types::Form::Bool['1']
=> true
[18] pry(main)> LocalSearch::Types::Form::Bool['0']
=> false
[19] pry(main)> LocalSearch::Types::Form::Bool['false']
=> false
[20] pry(main)> LocalSearch::Types::Form::Bool['False']
=> "False"
Fran Worley
@fran-worley
@panigrah can you send the rest of your schema?
Tim Cooper
@coop
@nil0bject these are the supported form boolean coercions - https://github.com/dry-rb/dry-types/blob/master/lib/dry/types/coercions/form.rb#L8-L10
panigrah
@panigrah
whats the preferred location to store dry-v error file for custom messages in a rails app?
dan-klasson
@dan-klasson
@panigrah probably config/locales/en/errors.yml
dan-klasson
@dan-klasson
@nil0bject why would it? this is not python ;)
Christopher Dennl-Ortega Arrieta
@cdennl
@panigrah name of the file doesn't matter as long as this file contains an 'errors' key
below the language
panigrah
@panigrah
@cdennl i was looking for the correct location to place this file in. @dan-klasson - dry-v is searching for custom error messages (for the unique?) test. Am adding it to config/locales.
Fran Worley
@fran-worley
You have to specify where your file is in the config
panigrah
@panigrah
thanks @fran-worley was looking to see where in the dir structure I should have this. will follow dan's suggestion. Is there a way to override the global location? i don't want to add this to every configure block in every schema.
Fran Worley
@fran-worley
@panigrah I guess you could create a base schema class with your error config and inherit from that. I am pretty sure there is no global method currently
Tim Riley
@timriley
I bet “no global method” would be by design :)
Fran Worley
@fran-worley
@timriley I'm sure but it would be lovely not to be able to declare it once... I include the message config line in every schema (and I have quite a number...)
And they reference the exact same files.
Tim Riley
@timriley
Couldn’t you do what you suggest above and create a base schema class?
panigrah
@panigrah
thank you @fran-worley
Fran Worley
@fran-worley
Yeah I'm sure provided you can extend the base config block
Plus I use Reform which defines its own schema class...
panigrah
@panigrah
@fran-worley i am using this with reform, which just passes the block over to dry-v - would i need to monkey patch it to override the base schema class?
Tim Riley
@timriley
@fran-worley yep, looking over the code, I think it would be no problem to have a base schema class with a configure do; config.messages = “…”; end and then other schemas inheriting from that base and providing their own configure blocks too.
Fran Worley
@fran-worley
@timriley good to know