Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Dec 14 14:41
    Travis dry-rb/dry-view (master) errored (638)
  • Dec 14 14:36

    dry-bot on master

    [devtools] config sync (compare)

  • Dec 14 14:36

    dry-bot on master

    [devtools] config sync (compare)

  • Dec 14 14:36

    dry-bot on master

    [devtools] config sync (compare)

  • Dec 14 14:36

    dry-bot on master

    [devtools] config sync (compare)

  • Dec 14 14:36

    dry-bot on master

    [devtools] config sync (compare)

  • Dec 14 14:36

    dry-bot on master

    [devtools] config sync (compare)

  • Dec 14 14:36

    dry-bot on master

    [devtools] config sync (compare)

  • Dec 14 14:36

    dry-bot on master

    [devtools] config sync (compare)

  • Dec 14 14:36

    dry-bot on master

    [devtools] config sync (compare)

  • Dec 14 14:36

    dry-bot on master

    [devtools] config sync (compare)

  • Dec 14 14:36

    dry-bot on master

    [devtools] config sync (compare)

  • Dec 14 14:36

    dry-bot on master

    [devtools] config sync (compare)

  • Dec 14 11:48

    flash-gordon on v1.2.2

    (compare)

  • Dec 14 11:47

    flash-gordon on master

    Update CHANGELOG (compare)

  • Dec 14 11:36
    flash-gordon closed #376
  • Dec 14 11:36

    flash-gordon on reject-string-keys

    (compare)

  • Dec 14 11:36

    flash-gordon on master

    Reject non-symbol keys in schem… Test invalid exception message Merge pull request #378 from dr… (compare)

  • Dec 14 11:36
    flash-gordon closed #378
  • Dec 14 11:24
    flash-gordon synchronize #378
Tim Riley
@timriley
the high-level rules work because they only run if the input values they require have passed any other validations
in that way they’re “safe”
and e.g. our predicate method can rely on its args being a certain type
Adam Davies
@adz
In examples above I’m referring to docs here http://dry-rb.org/gems/dry-validation/comparison-with-activemodel/
Tim Riley
@timriley
yeah. that’s passing static values as predicate args
Adam Davies
@adz
Ok i get that… but i read it as ‘scope?’ being a diff predicate

so… if there are two args
`.filled(prdicate_name?: :args_go_here)

would it be:

`.filled(prdicate_name?: [:arg1, :arg2])

Tim Riley
@timriley
yes
they’re splatted
Adam Davies
@adz
so it doesn’t make sense in the example, right?
Tim Riley
@timriley
no :(
Adam Davies
@adz

required(:email).filled(scoped_unique?: :email, scope?: { active: true })

should be

required(:email).filled(scoped_unique?: [:email, { active: true }])

Tim Riley
@timriley
yeah
Adam Davies
@adz
its hard when you don’t know how the DSL is structured… i’m kind of inferring from examples
getting clearer
Ok — @timriley i updated my PR to the docs to correct
dry-rb/dry-rb.org#138 let me know if that is correct now?
Adam Davies
@adz

One more thing — is it possible to infer the key of the predicate being tested?

that “required(:email).filled(unique?: :email)” has to repeat the ‘email’ key as an arg

Tim Riley
@timriley
@adz AFAIK the predicates don’t know which key they’re being used on, no
I thought there might’ve been a GH issue about this, but I can’t find it.
Adam Davies
@adz
ok
Adam Davies
@adz
Anyone use dry pipeline? Seems like dry transaction supersedes it with similar functionality
Tim Riley
@timriley
Yeah, dry-pipeline never really went anywhere
rom has something like it built internally for function composition but it’s not separate
Adam Davies
@adz
I feel the urge to chain functions and seems to fit
Tim Riley
@timriley
yeah, I use dry-monads and return monads to do that
maybe the pipeline thing is useful in other kinds of cases
Adam Davies
@adz
Doing elm has corrupted me such that I'm uncomfortable with mutations :0
Tim Riley
@timriley
:)
Adam Davies
@adz
This message was deleted
This message was deleted
First time doing rails for
A year or so
... Dry stuff feels very nice :smiley:
Tim Riley
@timriley
Good to hear! Still a way to go, but we’re getting there :)
Rafael
@lastk
how do I require a field only if the value of another field is equals to X ?
Vasilis Spilka
@vasspilka

hey there, a ruby question, how do we change namespace scope..
I remember you did something like

something < self
end

then you could define without saying def self.method

Rafael
@lastk
class < self
Vasilis Spilka
@vasspilka
oww yes, can I also use it to change the namespace in general
for example in order to avoid using Module::Class somewhere
becouse now that I think of it thats not what I wanted...
Rafael
@lastk
Im not sure what you want to do
Vasilis Spilka
@vasspilka
ok, let me get into more detail
I have the following
module Ranking
  class Ranking

    # bla bla bla stuff

    def get_score(user)
      Metrics::METRICS.reduce(0) do |points_total, (metric, points)|
        points_total + metric.calculate(user, @scope) * points
      end
    end
  end
end
module Ranking
  module Metrics
    METRICS = {
      Metrics::Messages       => 30,
      Metrics::Activity       => 40,
     ......
    }
  end
end
what I want to avoid is having to say Metrics::Xxxxxx in the METRICS constant
Vasilis Spilka
@vasspilka
I know I could just add "Metrics::" and the eval, but... I don't know seems like there should be a way to avoid that meta
Rafael
@lastk
it shouldnt be just: METRICS == { Messages => 30 } ?
Vasilis Spilka
@vasspilka
Well it could, but then the Ranking class that is in a different naming scope would fail to find them
Hmmm... I guess I could restructure the order of the modules.. but.. owww I just want better namespace handling :'( :sob:
Vasilis Spilka
@vasspilka
seems I can do this metric = Object.const_get("Metrics").const_get(metric.to_s), hurts my eyes