Class: Ds18b20::Parser
- Inherits:
-
Object
- Object
- Ds18b20::Parser
- Defined in:
- lib/ds18b20/parser.rb
Constant Summary collapse
- ERROR_READINGS =
[85000,127687]
- MAXIMUM_RETRIES =
3
Instance Method Summary collapse
- #get_temperature_celsius ⇒ Object (also: #celsius)
- #get_temperature_fahrenheit ⇒ Object (also: #fahrenheit)
- #get_temperature_kelvin ⇒ Object (also: #kelvin)
-
#initialize(file_location) ⇒ Parser
constructor
A new instance of Parser.
Constructor Details
#initialize(file_location) ⇒ Parser
Returns a new instance of Parser.
8 9 10 11 |
# File 'lib/ds18b20/parser.rb', line 8 def initialize(file_location) @file_location = file_location @retries = 0 end |
Instance Method Details
#get_temperature_celsius ⇒ Object Also known as: celsius
13 14 15 |
# File 'lib/ds18b20/parser.rb', line 13 def get_temperature_celsius get_temperature_from_file end |
#get_temperature_fahrenheit ⇒ Object Also known as: fahrenheit
17 18 19 |
# File 'lib/ds18b20/parser.rb', line 17 def get_temperature_fahrenheit (get_temperature_from_file * 9/5.0) + 32 end |
#get_temperature_kelvin ⇒ Object Also known as: kelvin
21 22 23 |
# File 'lib/ds18b20/parser.rb', line 21 def get_temperature_kelvin get_temperature_from_file + 273.15 end |