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
Enum#member_name is an internal helper method that returns the name of the enum member, or nil if it's an unnamed member.
I'd like to expose this method as part of the public API because it could be valuable for other use cases.
One example is Process::Status#to_s which relies on Enum#to_s if the status is a signal exit. Enum#to_s returns the name of the member, or the numerical representation if unnamed. A number however would be indistinguishable from the exit code of a normal exit. So for Process::Status#to_s we want to use the member name if available and otherwise use the unambiguous stringification from Enum#to_s (see #15280).
I'm sure there are other use cases as well. Additionally, this serves as a simple indication whether the enum member is named or not.
The text was updated successfully, but these errors were encountered:
Enum#member_name
is an internal helper method that returns the name of the enum member, ornil
if it's an unnamed member.I'd like to expose this method as part of the public API because it could be valuable for other use cases.
One example is
Process::Status#to_s
which relies onEnum#to_s
if the status is a signal exit.Enum#to_s
returns the name of the member, or the numerical representation if unnamed. A number however would be indistinguishable from the exit code of a normal exit. So forProcess::Status#to_s
we want to use the member name if available and otherwise use the unambiguous stringification fromEnum#to_s
(see #15280).I'm sure there are other use cases as well. Additionally, this serves as a simple indication whether the enum member is named or not.
The text was updated successfully, but these errors were encountered: