Class: StTools::Configuration
- Inherits:
-
Object
- Object
- StTools::Configuration
- Defined in:
- lib/st_tools.rb
Instance Attribute Summary collapse
-
#bytes_array ⇒ Object
Returns the value of attribute bytes_array.
-
#locale ⇒ Object
Returns the value of attribute locale.
-
#numbers_array ⇒ Object
Returns the value of attribute numbers_array.
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #rebuild_bytes_array ⇒ Object
- #rebuild_numbers_array ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
38 39 40 |
# File 'lib/st_tools.rb', line 38 def initialize locale = :ru end |
Instance Attribute Details
#bytes_array ⇒ Object
Returns the value of attribute bytes_array.
35 36 37 |
# File 'lib/st_tools.rb', line 35 def bytes_array @bytes_array end |
#locale ⇒ Object
Returns the value of attribute locale.
34 35 36 |
# File 'lib/st_tools.rb', line 34 def locale @locale end |
#numbers_array ⇒ Object
Returns the value of attribute numbers_array.
36 37 38 |
# File 'lib/st_tools.rb', line 36 def numbers_array @numbers_array end |
Instance Method Details
#rebuild_bytes_array ⇒ Object
55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/st_tools.rb', line 55 def rebuild_bytes_array keys = I18n.t('st_tools.bytes', locale: @locale).split(",") keys.map! { |x| x.strip } raise "Must be 6 elements in array #{keys.inspect}" if keys.count != 6 @bytes_array = Hash.new inc_value = 1024 keys.each do |key| @bytes_array[key] = inc_value inc_value *= 1024 end end |
#rebuild_numbers_array ⇒ Object
67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/st_tools.rb', line 67 def rebuild_numbers_array keys = I18n.t('st_tools.numbers', locale: @locale).split(",") keys.map! { |x| x.strip } raise "Must be 5 elements in array #{keys.inspect}" if keys.count != 5 @numbers_array = Hash.new inc_value = 1000 keys.each do |key| @numbers_array[key] = inc_value inc_value *= 1000 end end |