Class: SlowBlink::ENUM
Instance Attribute Summary collapse
- #name ⇒ String readonly
Attributes inherited from Type
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from Type
Instance Attribute Details
#name ⇒ String (readonly)
36 37 38 |
# File 'lib/slow_blink/enum.rb', line 36 def name @name end |
Class Method Details
.===(other) ⇒ Object
26 27 28 |
# File 'lib/slow_blink/enum.rb', line 26 def self.===(other) self == other end |
Instance Method Details
#symbol(nameOrVal) ⇒ Sym
89 90 91 92 93 94 95 96 97 98 99 100 101 |
# File 'lib/slow_blink/enum.rb', line 89 def symbol(nameOrVal) if nameOrVal.kind_of? String if (result = @symbols[nameOrVal]).nil? raise RangeError end result else if (result = @symbols.values.detect{|s|s.value == nameOrVal.to_i}).nil? raise RangeError end result end end |
#symbols ⇒ Array<Sym>
31 32 33 |
# File 'lib/slow_blink/enum.rb', line 31 def symbols @symbols.values end |