Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not depend on default_backend when the backend is explicitly passed #108

Closed
LostKobrakai opened this issue Sep 6, 2019 · 4 comments
Closed

Comments

@LostKobrakai
Copy link
Contributor

LostKobrakai commented Sep 6, 2019

Using Keyword.get_lazy and Keyword.put_new_lazy it is possible to not need to call for the default_backend and therefore not fail if it's not present (or needed).

Usecase is that I'd much rather have MyApp.CldrBackend.Money.to_string than needing configuration or passing opts. Basically like other cldr companion libraries work as well.

@LostKobrakai LostKobrakai changed the title Do not depend on default_backend when explicitly passed Do not depend on default_backend when the backend is explicitly passed Sep 6, 2019
@kipcole9
Copy link
Owner

kipcole9 commented Sep 6, 2019

Great idea - I did not know about get_lazy or put_new_lazy and they are exactly what are required! Thanks for the suggestion, I'll get on it. I've been puzzling over this lately so great timing too.

@kipcole9
Copy link
Owner

kipcole9 commented Sep 6, 2019

I've updated ex_cldr and ex_cldr_numbers to use Keyword.get_lazy/3. I've updated ex_money as well in the one place where the non-lazy version was being used with a Cldr.default_backend/0.

You would also like me to add a Cldr provider module that generates a <backend>.Money module with an api like the other ex_cldr_* packages? Makes sense to me and it doesn't place a dependency on any of the other packages. I'll work on this today if I've understood you correctly.

@LostKobrakai
Copy link
Contributor Author

Yeah, having it as another provides was what I was thinking about.

@kipcole9
Copy link
Owner

kipcole9 commented Sep 8, 2019

Added in ex_money version 4.3.0. Just add Money to the list of providers for a backend.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants