Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
Piotr Solnica
@solnic
that’s good to know
I quickly built it for transflow (but now I switched to call_sheet, which doesn’t use it)
so I don’t have any immediate interest in working on it
Andy Holland
@AMHOL
@solnic I can release if you give me access on rubygems
Piotr Solnica
@solnic
thanks, I’ll do that later today/tomorrow
Andy Holland
@AMHOL
Cool
Vladimir Kochnev
@marshall-lee
@solnic, @elskwid I use dry-pipeline from github.
@solnic and also I posted a PR to dry-pipeline, please review it before releasing. I believe it introduces some right thing
Piotr Solnica
@solnic
lol…I figured out how to optimize hints in a trivial way
dryrb/dry-validation@29e4689 <== seriously :joy:
every left-side-node will produce an error message by applying a predicate…so we can simply skip those, I’m astonished that the solution was that simple
@marshall-lee sure, and thanks for that, my time is limited so I can’t handle this for now. I’m happy to hand it over in general
Vladimir Kochnev
@marshall-lee
@AMHOL, @solnic I also have an idea for dry-pipeline to make it more like Elixir's pipe operator. now it's hard to use dry-pipeline with callable objects with more than one argument. I think that it'd be cool to have the ability to bind all arguments except first.
Piotr Solnica
@solnic
@marshall-lee yeah I was thinking about that too
my plan was to make it rock solid and use in transproc
and rom, too
this file is literally all the dry-pipeline thing :)
Piotr Solnica
@solnic
@marshall-lee maybe it’s because I copied it from there :joy:
which originally was copied from rom
such copy
Oskar Szrajer
@gotar
it's called extract to gem ;]
Piotr Solnica
@solnic
hah yes
Andy Holland
@AMHOL
This is so good I wish I could unwatch it to watch it for the first time again https://www.youtube.com/watch?v=_QdPW8JrYzQ
Piotr Solnica
@solnic
ok, seems like dry-v 0.7.0 is coming out tomorrow including improved hints :dancers:
two small improvements to make is removing input values from error msgs hash and adding support for hints in nested structures
oh and I also want to tweak required and maybe macros to support blocks, I’ll probably do that too
so ie key(:foo).required(:hash?) { |foo| foo.key(:bar).maybe(:int?) }
Andy Holland
@AMHOL
Nice one @solnic :D
Piotr Solnica
@solnic
@AMHOL I’m so happy with this :)
Don Morrison
@elskwid
Neat!
Piotr Solnica
@solnic
oh noez, I think I’ve got an idea how to get rid of checks
I mean, it’s good news, but I might end up working a couple of days longer
it’s worth a shot though
it would simplify the lib even more and make it faster, as we wouldn’t have run-time rule compilation for high-level rules
Andrew Kozin
@nepalez
@AMHOL @solnic what d'you think about dry-rb/dry-pipeline#2 ?
Hah! missed that comments above
Andy Holland
@AMHOL
@nepalez Yep, think that was my mistake, shouldn't have been there IMO
Fran Worley
@fran-worley

@solnic progress looks great, any ideas on what's causing this reform issue when using dry-validation from master?

TypeError: can't convert Dry::Validation::Schema::Rule::Result to Integer (Dry::Validation::Schema::Rule::Result#to_int gives Dry::Validation::Schema::Rule::Result)

It was working fine on 0.6...

Fran Worley
@fran-worley
Ignore me, I was being an idiot. All sorted.
Fran Worley
@fran-worley

@solnic is there a way to actually get the value of another key?
Ideally I want to be able to do something like:

value(:lockable_method).inclusion?(Lockable.lockable_methods[value(:lockable_type).underscore.to_sym])

If I define this as a custom predicate, I can make use of reforms 'form' variable to get the value but I can't find a way to include my inclusion array in the custom error message...

Piotr Solnica
@solnic
@fran-worley that’s not gonna be supported yet
and value(:foo).underscore will never work, since the dsl is “virtual"
you need a custom predicate for this kind of stuff
Fran Worley
@fran-worley
nope thats fine, I just wondered if there was a way to actually get the value for another key
value(:foo).value or something
Piotr Solnica
@solnic
@fran-worley value(:foo) will be evaluated to a value but the dsl is virtual, it only generates an ast so that we can generate rules
btw passing additional data to messages will be possible, but it’s not supported yet
Fran Worley
@fran-worley

@solnic ah ok thats fine, if I can pass additional data to messages then the custom predicate is no issue. I'm doing this currently:

key(:lockable_method){ |value| value.valid_method? }

def valid_method?(value)
  methods = Lockable.lockable_methods[form.lockable_type.underscore.to_sym].concat(["",nil])
  methods.include?(value)
end

It works fine its just my error message isn't particularly helpful...

Piotr Solnica
@solnic
yeah I know, I’ve been aware of this limitation since day 1 and it was always on my todo list, but first things first, as they say