Sha256: ad01e506209f6d6aa43b7a1e5be47e7b6cec96101e019fd6e9f68c3f7fb9a4a9
Contents?: true
Size: 1.44 KB
Versions: 8
Compression:
Stored size: 1.44 KB
Contents
class Radiosonde::DSL::Unit ALIASES = { 'Seconds' => :seconds, 'Microseconds' => :microseconds, 'Milliseconds' => :milliseconds, 'Bytes' => :bytes, 'Kilobytes' => :kilobytes, 'Megabytes' => :megabytes, 'Gigabytes' => :gigabytes, 'Terabytes' => :terabytes, 'Bits' => :bits, 'Kilobits' => :kilobits, 'Megabits' => :megabits, 'Gigabits' => :gigabits, 'Terabits' => :terabits, 'Percent' => :percent, 'Count' => :count, 'Bytes/Second' => :bytes_per_second, 'Kilobytes/Second' => :kilobytes_per_second, 'Megabytes/Second' => :megabytes_per_second, 'Gigabytes/Second' => :gigabytes_per_second, 'Terabytes/Second' => :terabytes_per_second, 'Bits/Second' => :bits_per_second, 'Kilobits/Second' => :kilobits_per_second, 'Megabits/Second' => :megabits_per_second, 'Gigabits/Second' => :gigabits_per_second, 'Terabits/Second' => :terabits_per_second, 'Count/Second' => :count_per_second, 'None' => :none, } class << self def conv_to_alias(unit) ALIASES[unit] || unit end def valid?(unit) ALIASES.keys.include?(unit) or ALIASES.values.include?(unit) end def normalize(unit) (ALIASES.respond_to?(:key) ? ALIASES.key(unit) : ALIASES.index(unit)) || unit end end # of class methods end
Version data entries
8 entries across 8 versions & 1 rubygems