Module: TemperatureConverter
- Defined in:
- lib/Temperature_Converter.rb,
lib/Temperature_Converter/version.rb
Constant Summary collapse
- VERSION =
"0.1.0"
Instance Method Summary collapse
- #c_to_f(x) ⇒ Object
- #c_to_k(x) ⇒ Object
- #f_to_c(x) ⇒ Object
- #f_to_k(x) ⇒ Object
- #k_to_c(x) ⇒ Object
- #k_to_f(x) ⇒ Object
Instance Method Details
#c_to_f(x) ⇒ Object
10 11 12 13 14 |
# File 'lib/Temperature_Converter.rb', line 10 def c_to_f(x) x.to_i x *= (9/5) x += 32 end |
#c_to_k(x) ⇒ Object
30 31 32 33 |
# File 'lib/Temperature_Converter.rb', line 30 def c_to_k(x) x.to_i x += 273.15 end |
#f_to_c(x) ⇒ Object
4 5 6 7 8 |
# File 'lib/Temperature_Converter.rb', line 4 def f_to_c(x) x.to_i x -= 32 x *= (5/9) end |
#f_to_k(x) ⇒ Object
16 17 18 19 20 21 |
# File 'lib/Temperature_Converter.rb', line 16 def f_to_k(x) x.to_i x -= 32 x *= (5/9) x += 273.15 end |
#k_to_c(x) ⇒ Object
35 36 37 38 |
# File 'lib/Temperature_Converter.rb', line 35 def k_to_c(x) x.to_i x -= 273.15 end |
#k_to_f(x) ⇒ Object
23 24 25 26 27 28 |
# File 'lib/Temperature_Converter.rb', line 23 def k_to_f(x) x.to_i x -= 273.15 x *= (9/5) x += 32 end |