Class: TextPrinter

Inherits:
Object
  • Object
show all
Defined in:
lib/printer/text_printer.rb

Instance Method Summary collapse

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



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