Class: Denko::Sensor::Temperature

Inherits:
Object
  • Object
show all
Includes:
Behaviors::Poller
Defined in:
lib/denko/sensor/virtual.rb

Instance Attribute Summary

Attributes included from Behaviors::Threaded

#interrupts_enabled, #thread

Attributes included from Behaviors::Callbacks

#callback_mutex

Instance Method Summary collapse

Methods included from Behaviors::Poller

#poll, #poll_using, #stop

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

#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

#_readObject



11
12
13
# File 'lib/denko/sensor/virtual.rb', line 11

def _read
  @sensor.read_temperature
end

#fahrenheitObject



18
19
20
# File 'lib/denko/sensor/virtual.rb', line 18

def fahrenheit
  (celsius * 9 / 5) + 32
end

#kelvinObject



22
23
24
# File 'lib/denko/sensor/virtual.rb', line 22

def kelvin
  celsius + 273.15
end