Class: CommonLib::TranslationTable
- Inherits:
-
Object
- Object
- CommonLib::TranslationTable
show all
- Defined in:
- lib/common_lib/translation_table.rb
Class Method Summary
collapse
Class Method Details
.[](key = nil) ⇒ Object
3
4
5
|
# File 'lib/common_lib/translation_table.rb', line 3
def self.[](key=nil)
short(key) || short(key.to_s.downcase) || value(key) || nil
end
|
.selector_options ⇒ Object
17
18
19
20
|
# File 'lib/common_lib/translation_table.rb', line 17
def self.selector_options
table.collect{|x| [x[:long],x[:value]] }
end
|
.short(key) ⇒ Object
24
25
26
27
|
# File 'lib/common_lib/translation_table.rb', line 24
def self.short(key)
index = table.find_index{|x| x[:short] == key.to_s }
( index.nil? ) ? nil : table[index][:value]
end
|
36
37
38
|
# File 'lib/common_lib/translation_table.rb', line 36
def self.table
[]
end
|
.valid_values ⇒ Object
11
12
13
14
|
# File 'lib/common_lib/translation_table.rb', line 11
def self.valid_values
table.collect{ |x| x[:value] }
end
|
.value(key) ⇒ Object
29
30
31
32
33
34
|
# File 'lib/common_lib/translation_table.rb', line 29
def self.value(key)
return nil if key == :nil
index = table.find_index{|x| x[:value] == key.to_i }
( index.nil? ) ? nil : table[index][:long]
end
|