Class: Denko::Sensor::Temperature
- Inherits:
-
Object
- Object
- Denko::Sensor::Temperature
- Includes:
- Behaviors::Poller
- Defined in:
- lib/denko/sensor/virtual.rb
Instance Attribute Summary
Attributes included from Behaviors::Threaded
Attributes included from Behaviors::Callbacks
Instance Method Summary collapse
- #_read ⇒ Object
- #fahrenheit ⇒ Object
-
#initialize(sensor) ⇒ Temperature
constructor
A new instance of Temperature.
- #kelvin ⇒ Object
Methods included from Behaviors::Poller
Methods included from Behaviors::Threaded
#enable_interrupts, included, #stop, #stop_thread, #threaded, #threaded_loop
Methods included from Behaviors::Reader
#read, #read_using, #wait_for_read
Methods included from Behaviors::Callbacks
#add_callback, #callbacks, #pre_callback_filter, #remove_callback, #update
Methods included from Behaviors::State
Constructor Details
#initialize(sensor) ⇒ Temperature
Returns a new instance of Temperature.
6 7 8 9 |
# File 'lib/denko/sensor/virtual.rb', line 6 def initialize(sensor) @sensor = sensor super end |
Instance Method Details
#_read ⇒ Object
11 12 13 |
# File 'lib/denko/sensor/virtual.rb', line 11 def _read @sensor.read_temperature end |
#fahrenheit ⇒ Object
18 19 20 |
# File 'lib/denko/sensor/virtual.rb', line 18 def fahrenheit (celsius * 9 / 5) + 32 end |
#kelvin ⇒ Object
22 23 24 |
# File 'lib/denko/sensor/virtual.rb', line 22 def kelvin celsius + 273.15 end |