-
Notifications
You must be signed in to change notification settings - Fork 79
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
Enum Bang setter #82
Enum Bang setter #82
Conversation
README.md
Outdated
@@ -109,8 +109,8 @@ enum = Kredis.enum "myenum", values: %w[ one two three ], default: "one" | |||
true == enum.one? # => GET myenum | |||
enum.value = "two" # => SET myenum "two" | |||
"two" == enum.value # => GET myenum | |||
enum.value = "four" | |||
"two" == enum.value # => GET myenum | |||
enum.four! # => SET myenum "four" |
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.
Does it make sense that you can set the enum to a value which is not available in the values
array?
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.
Good point. Thanks for the feedback. Updated the example.
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.
Hmmm. It's not a very nice exception when you try setting an invalid value.
* main: Bump version for 1.2.0 Use pipeline for migration too Ensure to pass the pipeline to super Use block parameter to pipeline in Redis#multi (rails#68) Note tested / supported versions of Redis in the Readme (rails#79) Return counter value after incrementing/decrementing Enum Bang setter (rails#82) Add reset to Cycle after_change callbacks Add example in Readme.md Support configuring custom keys via method invocation Use bundle add instead (rails#81)
* main: Bump version for 1.2.0 Use pipeline for migration too Ensure to pass the pipeline to super Use block parameter to pipeline in Redis#multi (rails#68) Note tested / supported versions of Redis in the Readme (rails#79) Return counter value after incrementing/decrementing Enum Bang setter (rails#82) Add reset to Cycle after_change callbacks Add example in Readme.md Support configuring custom keys via method invocation Use bundle add instead (rails#81)
Add a bang method to set enums. This makes it function a bit more like the rails enums.