Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • 15:43
    FioFiyo starred dry-rb/dry-types
  • 11:52
    flash-gordon commented #361
  • 07:09
    unixc3t starred dry-rb/dry-types
  • Oct 22 22:33
    patrickclery commented #361
  • Oct 22 21:12
    D1mon starred dry-rb/dry-matcher
  • Oct 22 15:44
    graudeejs starred dry-rb/dry-container
  • Oct 22 08:41
    esparta commented #366
  • Oct 22 08:39
    flash-gordon commented #366
  • Oct 22 08:39

    flash-gordon on master

    Fix error on Dry::Types::Array#… Merge pull request #366 from es… (compare)

  • Oct 22 08:39
    flash-gordon closed #366
  • Oct 22 08:38
    flash-gordon closed #362
  • Oct 22 08:38
    flash-gordon commented #362
  • Oct 22 08:37
    flash-gordon closed #361
  • Oct 22 08:37
    flash-gordon commented #361
  • Oct 22 07:48

    solnic on master

    Adding missing built-in predica… Merge pull request #65 from esp… Merge branch 'release-1.0' (compare)

  • Oct 22 07:47

    solnic on release-1.0

    Adding missing built-in predica… Merge pull request #65 from esp… (compare)

  • Oct 22 07:47
    solnic closed #65
  • Oct 22 07:29
    esparta opened #65
  • Oct 22 07:06
  • Oct 22 06:23
    robturtle starred dry-rb/dry-monads
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
Vasilis Spilka
@vasspilka
Hmmm... thats interesting... turns out I'm a whiny prick and it worked all along like you mention @lastk.
I must have been doing something different earlier or was just ignorant.. sry
Rafael
@lastk
haaha, np :)
Andy Holland
@AMHOL
@vasspilka pretty sure you can write that like: Metrics.const_get(metric)
Ralf Schmitz Bongiolo
@mrbongiolo
On dry-validation, when using rules inside an array why they don't return the item index like other errors?
Ex: {:should_have_investment_rate_only=>["must be filled", "must be filled", "must be filled", "cannot be defined"], 2=>{:minimum_investment=>["is missing"]}}
The rule :should_have_investment_rate_only return an array of error messages, but it's not possible to know if it was on item 1,2 or 42..
Tim Riley
@timriley
@mrbongiolo that sounds like a bug to me. Worth filing a GH issue?
Ralf Schmitz Bongiolo
@mrbongiolo
I'll do it @timriley
Tim Riley
@timriley
Thanks!
Abinoam P. Marques Jr.
@abinoam
Hi @vasspilka . Im a little late at the conversation and im lacking context. Where is Metrics::Messages being defined? It seems it's just being resolve inside the METRICS hash definition.
Maciej Mensfeld
@mensfeld
hello
+egl?+ is not a valid predicate name
any idea?
aaaa
sorry
eql
typo
damn
:) works like a charm
Alessandro Desantis
@aldesantis
Hello guys! I am trying to distribute my own set of Dry::Validation predicates. I just made a predicate container and the use can call predicates in the configure block to use them, but I can't figure how to distribute the messages.
There does not seem to be a way to add messages to the current ones?
Christopher Dennl-Ortega Arrieta
@cdennl
@alessandro1997 messages file
it is in the docs
Darin Haener
@dphaener
Hello!
Philip Arndt
@parndt
How should I deal with validating a hash that has string keys when my validator looks like required(:field_type) and I have {"field_type" => "value"}?
Tim Riley
@timriley
@parndt use a form schema? Dry::Validation.Form do ...
Form schemas are designed to expect stringy keys and do various other coercions
Philip Arndt
@parndt
@timriley nice, thanks! I was just using a .Schema
Philip Arndt
@parndt
@timriley {:errors=>{:content_type=>{:field_schema=>{:author=>{:field_type=>["must be filled"]}}}}} :+1: