Class: Lite::Measurements::Temperature
- Defined in:
- lib/lite/measurements/temperature.rb
Constant Summary collapse
- C_FREEZING_POINT =
5.0 / 9.0
- C_INVERSED_POINT =
9.0 / 5.0
- F_FREEZING_POINT =
32.0
- K_FREEZING_POINT =
273.15
- VALID_KEYS =
i[ celsius fahrenheit kelvin ].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
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/lite/measurements/temperature.rb', line 16 def convert(from:, to:) assert_all_valid_keys!(from, to, VALID_KEYS) case to when from then amount when :celsius then send("celsius_from_#{from}") when :fahrenheit then send("fahrenheit_from_#{from}") when :kelvin then send("kelvin_from_#{from}") end end |