Class: Skiff::Probe

Inherits:
Object
  • Object
show all
Defined in:
lib/skiff/probe.rb

Instance Method Summary collapse

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

#fahrenheitObject



7
8
9
# File 'lib/skiff/probe.rb', line 7

def fahrenheit
  (temperature * 1.8) + 32.0
end

#rawObject



11
12
13
# File 'lib/skiff/probe.rb', line 11

def raw
  file_contents = File.read(@full_path_name)
end

#temperatureObject



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