Class: Enu
- Inherits:
-
Object
- Object
- Enu
- Extended by:
- Forwardable
- Defined in:
- lib/enu.rb,
lib/enu/version.rb
Constant Summary collapse
- VERSION =
"0.1.2"
Class Attribute Summary collapse
- .options ⇒ Object readonly
Class Method Summary collapse
Class Attribute Details
.options ⇒ Object
20 21 22 |
# File 'lib/enu.rb', line 20 def @options ||= {}.freeze end |
Class Method Details
.default ⇒ Object
47 48 49 50 |
# File 'lib/enu.rb', line 47 def default raise "empty enum, sad enum" unless &.any? keys.first end |
.inherited(descendant) ⇒ Object
42 43 44 45 |
# File 'lib/enu.rb', line 42 def inherited(descendant) = &.clone || {}.freeze descendant.class_eval { self. = } end |
.to_json ⇒ Object
52 53 54 |
# File 'lib/enu.rb', line 52 def to_json keys.map { |key| [key, key] }.to_h.to_json end |