Class: ChemistryParadise::CelsiusToKelvin
- Inherits:
-
Object
- Object
- ChemistryParadise::CelsiusToKelvin
show all
- Includes:
- Converters
- Defined in:
- lib/chemistry_paradise/converters/celsius_to_kelvin.rb
Overview
ChemistryParadise::CelsiusToKelvin
Constant Summary
collapse
- NAMESPACE =
inspect
Constants included
from Converters
ChemistryParadise::Converters::CELSIUS_TO_FAHRENHEIT_CONVERSION_FACTOR, ChemistryParadise::Converters::FAHRENHEIT_TO_CELSIUS_CONVERSION_FACTOR
Class Method Summary
collapse
-
.[](i = ARGV) ⇒ Object
# === CelsiusToKelvin[] ========================================================================= #.
Instance Method Summary
collapse
Constructor Details
#initialize(celsius = 0, run_already = true) ⇒ CelsiusToKelvin
38
39
40
41
42
43
44
45
|
# File 'lib/chemistry_paradise/converters/celsius_to_kelvin.rb', line 38
def initialize(
celsius = 0,
run_already = true
)
reset
set_celsius(celsius)
run if run_already
end
|
Class Method Details
.[](i = ARGV) ⇒ Object
115
116
117
118
|
# File 'lib/chemistry_paradise/converters/celsius_to_kelvin.rb', line 115
def self.[](i = ARGV)
_ = new(i)
_.report
end
|
Instance Method Details
#celsius? ⇒ Boolean
Also known as:
n_celsius
77
78
79
|
# File 'lib/chemistry_paradise/converters/celsius_to_kelvin.rb', line 77
def celsius?
@celsius
end
|
#do_the_calculation ⇒ Object
#
do_the_calculation
We determine how many Fahrenheit we have here, by using the specific formula.
#
70
71
72
|
# File 'lib/chemistry_paradise/converters/celsius_to_kelvin.rb', line 70
def do_the_calculation
@kelvin = @celsius + 273.15
end
|
#opnn ⇒ Object
101
102
103
|
# File 'lib/chemistry_paradise/converters/celsius_to_kelvin.rb', line 101
def opnn
Opn.opn(use_this_as_namespace: NAMESPACE)
end
|
#report_result ⇒ Object
Also known as:
report
84
85
86
87
88
89
|
# File 'lib/chemistry_paradise/converters/celsius_to_kelvin.rb', line 84
def report_result
opnn if use_opn?
e rev+
n_celsius.to_s+'° '+simp('Celsius')+' are '+@kelvin.to_s+
' '+simp('Kelvin')+'.'
end
|
#reset ⇒ Object
50
51
52
|
# File 'lib/chemistry_paradise/converters/celsius_to_kelvin.rb', line 50
def reset
set_celsius
end
|
#run ⇒ Object
108
109
110
|
# File 'lib/chemistry_paradise/converters/celsius_to_kelvin.rb', line 108
def run
do_the_calculation
end
|
#set_celsius(i = 0) ⇒ Object
57
58
59
60
61
62
|
# File 'lib/chemistry_paradise/converters/celsius_to_kelvin.rb', line 57
def set_celsius(i = 0)
i = i.first if i.is_a? Array
i = i.to_s.dup
i = i.to_f @celsius = i
end
|
#use_opn? ⇒ Boolean
94
95
96
|
# File 'lib/chemistry_paradise/converters/celsius_to_kelvin.rb', line 94
def use_opn?
false
end
|