Module: LiveF1::Enum
- Defined in:
- lib/live_f1/enum.rb
Overview
Adds a convenience method for converting between constant values and names
Instance Method Summary collapse
-
#name_for(value) ⇒ Object
Returns the first constant (in definition order) matching the given value.
Instance Method Details
#name_for(value) ⇒ Object
Returns the first constant (in definition order) matching the given value
5 6 7 |
# File 'lib/live_f1/enum.rb', line 5 def name_for value constants.detect { |c| const_get(c) == value } end |