Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
Soumya Ray
@soumyaray
@cdennl: then i'm doubly thankful for all your help! i really see the value of dry-rb and rom-rb, but their predecessors (virtus, sequel, etc.) have spoilt me on being braindead simple to start up on. i'm paying the piper for that now. :)
David Strauß
@stravid
I just stumbled upon dry-container and I'm not sure in which scenarios such a pattern is best used. Can someone give me reading recommendations to dive into this topic?
Oskar Szrajer
@gotar
maybe source code of: https://github.com/solnic/rodakase-blog and dry-web
not sure there is any good article, tutorial
Tim Riley
@timriley
@stravid http://dry-rb.org/gems/dry-component/ also shows how you can use a container to manage an app’s dependencies.
I hope to write some articles/tutorials and share some OSS example apps, but it might be a month or two before they’re all out.
Tim Riley
@timriley
Yeah, dry-container is pretty great for flexible plugin registries and the like.
The container we use for step adapters in dry-transaction makes stuff like this possible: http://dry-rb.org/news/2016/04/07/dry-transaction-0-6-brings-powerful-new-support-for-custom-step-adapters/
(the part where you inherit from Dry::Transaction::StepAdapters to extend the default container with your own items)
Benjamin Klotz
@tak1n
@timriley we use it for different api error handlers -> register :facebook, FacebookErrorHandler.new etc etc and then depending on which platform u want to publish it resolves to the proper error handler to see what happened on error cases and with which errors we can deal in a somewhat meaningful way
Tim Riley
@timriley
Nice. This is a good pattern.
Benjamin Klotz
@tak1n
I really like it :D
Tim Riley
@timriley
In the past I’ve done silly things like constantizing strings to try and get class names.
Benjamin Klotz
@tak1n
yep
const_get inc
Tim Riley
@timriley
But that’s so fragile. And not flexible.
Registering things with an explicit name is much much better.
Benjamin Klotz
@tak1n
yep, with const_get its easy to get everything u could possible get as const, and you have to deal with that eg.: use const_get only on proper modules where its allowed etc
with this registering and resolving its pretty explicit and you don't forget that
David Strauß
@stravid
I see, I will have to do some reading and thinking to figure out how it fits into my understanding of app development. Thanks for the input @tak1n @timriley
Simon Schmid
@sled
also it's much easier to write stubs ;)
Tim Riley
@timriley
Published the next in my “convince everyone to Ruby the dry-rb way” series: http://icelab.com.au/articles/inactive-records-the-value-objects-your-app-deserves/
Tim Cooper
@coop
s/Upboat/Upvote/
I think I prefer upboat.
Tim Riley
@timriley
aww, where’s the fun in that? ;)
Benjamin Klotz
@tak1n
@timriley awesome post, also upboated it ;) :D
Tim Riley
@timriley
Thanks! In 8 more post’s time, maybe I’ll be ready to introduce an actual app structure, haha
Benjamin Klotz
@tak1n
I'm waiting for it :P
Actually what's the plan with dry-web?
Any help needed to make progress?
Tim Cooper
@coop
I also think it was a good read :)
Tim Riley
@timriley
I’ll make a release this week, just so it’s out on rubygems. There’s plenty we could do with it, I think it might be good if we could get a bunch of things listed out into GH issues. Might need to wait for solnic to get back for some of that to happen. But I might start noting down some things when I get a chance :)
Benjamin Klotz
@tak1n
Okay, cool just ping me if you have smth I can help with :)
Tim Riley
@timriley
Awesome, will do.
dan-klasson
@dan-klasson
```
    def key(name, &block)
      ::Kernel.warn 'key is deprecated - use required instead.'

      required(name, &block)
    end
docs are not updated?
Tim Riley
@timriley
@dan-klasson this isn’t released as a gem version yet
We have doc updates waiting on the releases.
dan-klasson
@dan-klasson
@timriley cool, thx
Tim Riley
@timriley
No probs!
dan-klasson
@dan-klasson
@timriley is master stable? is it safe to use?
Tim Riley
@timriley
I reckon so
Of course, you take a risk whenever you use master of anything, but AFAIK it’s fine here :)
panigrah
@panigrah

@timriley the following doesn't work on master any more. fails with a NoMethodError for 'key'

 require 'dry-validation'
 class Schema < Dry::Validation::Schema::Form
      key(:email) { |email| email.filled? }
  end

did the API change?

Tim Riley
@timriley
Yeah, it did.
required(:email).filled is whart you want now
dry-rb/dry-validation#99 is a decent summary