-
Notifications
You must be signed in to change notification settings - Fork 23
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
Remove const_missing method in favor of const_set #16
Conversation
b35623f
to
e76918e
Compare
spec/ruby-enum/enum_spec.rb
Outdated
@@ -169,4 +169,13 @@ class EmptyEnums | |||
expect { EmptyEnums::ORANGE }.to raise_error Ruby::Enum::Errors::UninitializedConstantError | |||
end | |||
end | |||
|
|||
# https://github.com/dblock/ruby-enum/pull/11 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this comment is useful, it's pretty clear what's going on. CHANGELOG and git blame
can always help you find the source.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Thanks
Looks great. Just missing CHANGELOG entry please. |
e76918e
to
7e6fe91
Compare
Define constant with const_set instead of "fetching" them with const_missing. These changes were proposed by @dmoss18 in his initial PR (dblock#11). I also add a spec to support the new feature. I kept const_missing method in order to raise the custom Ruby::Enum::Errors::DuplicateKeyError since it provides a handy way to inform the end user for the exception raised.
7e6fe91
to
f0e09fa
Compare
Feel free to make a release with this @laertispappas. |
Sure. I will. Thanks. |
This is all we need right now, and dblock/ruby-enum#16 is causing issues for new installs.
This change has caused some issues in my projects that rely on ruby-enum:
The definition of my enum is here. Am I doing something wrong? I'm not sure why this redefinition error change would now start raising |
@gjtorikian Can you reopen a new issue? Maybe with a failing test, please? |
Define constant with const_set instead of "fetching"
them with const_missing. These changes were proposed
by @dmoss18 in his initial PR (#11).
I kept const_missing method in order to raise the custom
Ruby::Enum::Errors::DuplicateKeyError since
it provides a handy way to inform the end user
for the exception raised.