Class: HtmlPrinter

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

Instance Method Summary collapse

Constructor Details

#initialize(temperature) ⇒ HtmlPrinter

Returns a new instance of HtmlPrinter.



3
4
5
# File 'lib/printer/html_printer.rb', line 3

def initialize(temperature)
    @temperature = temperature
end

Instance Method Details



7
8
9
10
11
12
13
# File 'lib/printer/html_printer.rb', line 7

def print
    "<div>\r\n"\
    "   <div>#{@temperature.to_celsius} °C</div>\r\n"\
    "   <div>#{@temperature.to_fahrenheit} °F</div>\r\n"\
    "   <div>#{@temperature.to_kelvin} K</div>\r\n"\
    "</div> "
end