Class: JsonPrinter
- Inherits:
-
Object
- Object
- JsonPrinter
- Defined in:
- lib/printer/json_printer.rb
Instance Method Summary collapse
-
#initialize(temperature) ⇒ JsonPrinter
constructor
A new instance of JsonPrinter.
- #print ⇒ Object
Constructor Details
#initialize(temperature) ⇒ JsonPrinter
Returns a new instance of JsonPrinter.
3 4 5 |
# File 'lib/printer/json_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/json_printer.rb', line 7 def print "{"\ "celsius: #{@temperature.to_celsius}, "\ "fahrenheit: #{@temperature.to_fahrenheit}, "\ "kelvin: #{@temperature.to_kelvin}"\ "}" end |