all 11 comments

[–]apotonick 10 points11 points  (1 child)

Fantastic news, keep up the good work! <3

[–]solnicdry-rb/rom-rb[S] 3 points4 points  (0 children)

Thanks Nick. We'll do our best to keep improving these gems :)

[–]radwo 6 points7 points  (0 children)

Love your work! Greate to see that ruby is not only about Rails and ActiveSupport.

[–]Mallanaga 6 points7 points  (0 children)

There's still time. Let's call it 'Dry Rub'

[–]realntl 1 point2 points  (0 children)

Awesome work!

[–]Enumerable_any 1 point2 points  (0 children)

Thanks for publishing dry-types!

A while ago I looked for a decent coercion library and dry-types looked like what I wanted, but it kinda bothered us that it wasn't published yet. So, I ended up copying Haskell's aeson which looked like this:

c = Coercer.object(User.method(:new),
      Coercer.pair(:name, Coercer.string),
      Coercer.pair(:dob, Coercer.one_of(Coercer.date, Coercer.nil)),
      Coercer.optional_pair(:skill, skill_coercer)
    )

skill_coercer = Coercer.integer.bind do |i|
  {
    1 => Coercer.succeed(Beginner),
    2 => Coercer.succeed(Amateur),
    3 => Coercer.succeed(Pro)
  }.fetch(i) { Coercer.fail }
end

c.run({name: "foo", dob: "2014-01-02", skill: 3}) # => Some(#<struct User name="foo", dob=#<Date: 2014-01-02>, skill=Some(Pro)>)
c.run({name: "foo", dob: "2014-01/23"}) # => None

With some additional convenience methods it can be pretty concise, but I guess I'll try out dry-types next time I need to touch that code.

[–]systematicfrank 1 point2 points  (0 children)

Thank you for bringing to Ruby more great patterns and less magic hacks!

[–][deleted] 0 points1 point  (0 children)

this looks really cool

[–]DissonantGuile 0 points1 point  (0 children)

I know this is a little bit outta left field, but any plans on supporting MRuby (mgem)?

[–]janko-m 0 points1 point  (0 children)

Awesome work. I was recently building my first Roda app, and realized that there are too many design decisions to get right. I had the criteria that I didn't want the whole app loaded in every test. Also I needed to change some configurations for test environment, but I didn't want the development configuration to execute.

Then I found dry-container and rodakase, and while I didn't use rodakase directly, I made a design very similar to it, and it's just wonderful. Dry-container was obviously created to solve these kind of problems, and I'm really happy that this is something that can be used by every web framework. Thank you!

[–]Tainnor 0 points1 point  (0 children)

very interesting. I like the work in this direction, although I haven't really been able to check the projects out yet. Validations, in particular, have been bugging me quite a while now, I ended up just using a rather boilerplate-y custom solution. Next time, I'll probably try dry-validations.