These are chat archives for dry-rb/chat

May 2017
May 26 2017 05:33
I went with something to that effect, the issue is that a.rb has a include Inject[:b] and when register(:a, happens it's expecting that :b has already been instantiated in the container..
Tim Riley
May 26 2017 05:41
@stergiom what you want instead is to register a block that returns your object:
register(:a) { }
This means the instantiation is lazy, and this’ll allow both :a and :b to be registered before you resolve :a from the container the first time
May 26 2017 05:52
@timriley, is the instantiation still a singleton when used this way?
Tim Riley
May 26 2017 05:53
@stergiom they’re not singletons when used like that, no. Every time you resolve :a from the container it’ll be a new object.
I think dry-container might have an option for that though… /me looks
Nope, I was wrong.
you could probably write a dry-container resolver that’ll resolve from the block once and then return that original object in subsequent times
May 26 2017 05:58
:beers: might actually give that a shot
Tim Riley
May 26 2017 05:59
Cool, let us know how it goes!
I’d be interested to see it.
Tsehau Chao
May 26 2017 10:02

Hiya, just starting with dry-validation here. I’m using custom error messages with i18n:

configure do
    config.messages_file = "config/locales/errors.zh-TW.yml"
    config.messages = :i18n

Not sure if this is intended, but by doing so, I get Dry::Validation::MissingMessageError for the built-in predicates (e.g. int?). Makes sense in a way, since I only have my custom messages in that yml, but OTOH it’s also fair to assume that the i18n lookup should fall back to the built-in messages?

Anyway my actual question is, so I have a fully translated errors.zh-TW.yml ready to share but where should I push to :D