Class: HtmlPrinter
- Inherits:
-
Object
- Object
- HtmlPrinter
- Defined in:
- lib/printer/html_printer.rb
Instance Method Summary collapse
-
#initialize(temperature) ⇒ HtmlPrinter
constructor
A new instance of HtmlPrinter.
- #print ⇒ Object
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
#print ⇒ Object
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 |