Class: Lite::Measurements::DigitalStorage
- Includes:
- Helpers::ShiftHelper
- Defined in:
- lib/lite/measurements/digital_storage.rb
Constant Summary collapse
- DIGITAL_STORAGE_UNITS =
{ bytes: 1.0, kilobytes: 1024.0, megabytes: 1024.0**2, gigabytes: 1024.0**3, terabytes: 1024.0**4, petabytes: 1024.0**5, exabytes: 1024.0**6 }.freeze
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
Methods inherited from Base
Constructor Details
This class inherits a constructor from Lite::Measurements::Base
Instance Method Details
#convert(from:, to:) ⇒ Object
19 20 21 22 23 24 |
# File 'lib/lite/measurements/digital_storage.rb', line 19 def convert(from:, to:) assert_all_valid_keys!(from, to, DIGITAL_STORAGE_UNITS.keys) return amount if equal_units?(from, to) shift_units(amount, type: DIGITAL_STORAGE_UNITS, from: from, to: to) end |