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

Sugar! to get backing value directly #65

Open
almozavr opened this issue Sep 3, 2018 · 1 comment
Open

Sugar! to get backing value directly #65

almozavr opened this issue Sep 3, 2018 · 1 comment

Comments

@almozavr
Copy link

almozavr commented Sep 3, 2018

Issue

dump/1 returns {:ok, integer} while we'd lite to access value directly (e.g. for views adapters)

Proposal

dump!/1 to return integer or to raise exception

@yunmikun2
Copy link

@almozavr, you can use __enum__map__/0 to get kw list with keys-values. So suppose you have a type MyApp.MyEnum which contains a key :key, then you can get its backing value like this:

MyApp.MyEnum.__enum_map__[:key]

On the other side I don't see why would you need this value in views or adapters? What's exactly the case?

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