Class: Lite::Measurements::Time

Inherits:
Base
  • Object
show all
Includes:
Helpers::ShiftHelper
Defined in:
lib/lite/measurements/time.rb

Instance Attribute Summary

Attributes inherited from Base

#amount

Instance Method Summary collapse

Methods inherited from Base

convert, #initialize

Constructor Details

This class inherits a constructor from Lite::Measurements::Base

Instance Method Details

#convert(from:, to:) ⇒ Object



15
16
17
18
19
20
# File 'lib/lite/measurements/time.rb', line 15

def convert(from:, to:)
  assert_all_valid_keys!(from, to, TIME_UNITS.keys)
  return amount if equal_units?(from, to)

  shift_units(amount, type: TIME_UNITS, from: from, to: to)
end