You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 674126d
Browse filesBrowse the repository at this point in the historyBrowse files
Ruby 4.0 reserves the top-level Ruby module for the language itself,
so reopening 'module Ruby' in this gem is no longer safe. Renames the
gem's namespace from Ruby::Enum to RubyEnum::Enum and bumps the major
version to 2.0.0.
For backward compatibility, Ruby::Enum (and Ruby::Enum::Case,
Ruby::Enum::Errors) remain available as deprecated aliases that warn
on inclusion and delegate to RubyEnum::Enum. They will be removed in
a future major version.
Closes#55.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copy file name to clipboardExpand all lines: CHANGELOG.md
+2-1Lines changed: 2 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,6 @@
1
-
### 1.2.0 (Next)
1
+
### 2.0.0 (Next)
2
2
3
+
*[#55](https://github.com/dblock/ruby-enum/issues/55): Renamed `Ruby::Enum` to `RubyEnum::Enum` since Ruby 4.0 reserves the top-level `Ruby` module - [@dblock](https://github.com/dblock).
@@ -232,11 +232,11 @@ The `DuplicateValueError` exception is raised to be consistent with the unique k
232
232
233
233
### Inheritance
234
234
235
-
When inheriting from a `Ruby::Enum` class, all defined enums in the parent class will be accessible in sub classes as well. Sub classes can also provide extra enums, as usual.
235
+
When inheriting from a `RubyEnum::Enum` class, all defined enums in the parent class will be accessible in sub classes as well. Sub classes can also provide extra enums, as usual.
If you want to make sure that you cover all cases in a case stament, you can use the exhaustive case matcher: `Ruby::Enum::Case`. It will raise an error if a case/enum value is not handled, or if a value is specified that's not part of the enum. This is inspired by the [Rust Pattern Syntax](https://doc.rust-lang.org/book/ch18-03-pattern-syntax.html). If multiple cases match, all matches are being executed. The return value is the value from the matched case, or an array of return values if multiple cases matched.
267
+
If you want to make sure that you cover all cases in a case stament, you can use the exhaustive case matcher: `RubyEnum::Enum::Case`. It will raise an error if a case/enum value is not handled, or if a value is specified that's not part of the enum. This is inspired by the [Rust Pattern Syntax](https://doc.rust-lang.org/book/ch18-03-pattern-syntax.html). If multiple cases match, all matches are being executed. The return value is the value from the matched case, or an array of return values if multiple cases matched.
268
268
269
269
> NOTE: This will add checks at runtime which might lead to worse performance. See [benchmarks](#benchmarks).
270
270
271
-
> NOTE: `:else` is a reserved keyword if you want to use `Ruby::Enum::Case`.
271
+
> NOTE: `:else` is a reserved keyword if you want to use `RubyEnum::Enum::Case`.
0 commit comments