Class: Skiff::Probe
- Inherits:
-
Object
- Object
- Skiff::Probe
- Defined in:
- lib/skiff/probe.rb
Instance Method Summary collapse
- #fahrenheit ⇒ Object
-
#initialize(base_path, name) ⇒ Probe
constructor
A new instance of Probe.
- #raw ⇒ Object
- #temperature ⇒ Object
Constructor Details
#initialize(base_path, name) ⇒ Probe
Returns a new instance of Probe.
3 4 5 |
# File 'lib/skiff/probe.rb', line 3 def initialize(base_path, name) @full_path_name = File.join([base_path, name, "w1_slave"]) end |
Instance Method Details
#fahrenheit ⇒ Object
7 8 9 |
# File 'lib/skiff/probe.rb', line 7 def fahrenheit (temperature * 1.8) + 32.0 end |
#raw ⇒ Object
11 12 13 |
# File 'lib/skiff/probe.rb', line 11 def raw file_contents = File.read(@full_path_name) end |
#temperature ⇒ Object
15 16 17 18 19 |
# File 'lib/skiff/probe.rb', line 15 def temperature temperature_data = raw.split('t=').last temperature = temperature_data.to_f / 1000 return temperature end |