Class: NicInfo::Enum
- Inherits:
-
Object
show all
- Defined in:
- lib/nicinfo/enum.rb
Overview
A base class for enumerations
Class Method Summary
collapse
Class Method Details
.add_item(key, value) ⇒ Object
24
25
26
27
|
# File 'lib/nicinfo/enum.rb', line 24
def Enum.add_item( key, value )
@hash ||= {}
@hash[ key ] = value
end
|
.const_missing(key) ⇒ Object
29
30
31
|
# File 'lib/nicinfo/enum.rb', line 29
def Enum.const_missing( key )
@hash[ key ]
end
|
.each ⇒ Object
33
34
35
|
# File 'lib/nicinfo/enum.rb', line 33
def Enum.each
@hash.each { |key,value| yield( key, value ) }
end
|
.has_value?(value) ⇒ Boolean
37
38
39
|
# File 'lib/nicinfo/enum.rb', line 37
def Enum.has_value? value
@hash.value?( value )
end
|
.values ⇒ Object
41
42
43
|
# File 'lib/nicinfo/enum.rb', line 41
def Enum.values
@hash.values
end
|