Class: TextPrinter
- Inherits:
-
Object
- Object
- TextPrinter
- Defined in:
- lib/printer/text_printer.rb
Instance Method Summary collapse
-
#initialize(temperature) ⇒ TextPrinter
constructor
A new instance of TextPrinter.
- #print ⇒ Object
Constructor Details
#initialize(temperature) ⇒ TextPrinter
Returns a new instance of TextPrinter.
4 5 6 |
# File 'lib/printer/text_printer.rb', line 4 def initialize(temperature) @temperature = temperature end |
Instance Method Details
#print ⇒ Object
8 9 10 11 12 13 |
# File 'lib/printer/text_printer.rb', line 8 def print "Temperature:\r\n"\ " #{@temperature.to_celsius} °C\r\n"\ " #{@temperature.to_fahrenheit} °F\r\n"\ " #{@temperature.to_kelvin} K" end |