Class: TemperatureReadFile
- Inherits:
-
Object
- Object
- TemperatureReadFile
- Defined in:
- lib/temperature_read_file.rb
Instance Attribute Summary collapse
-
#temp ⇒ Object
readonly
Returns the value of attribute temp.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ TemperatureReadFile
constructor
A new instance of TemperatureReadFile.
Constructor Details
#initialize ⇒ TemperatureReadFile
Returns a new instance of TemperatureReadFile.
11 12 13 |
# File 'lib/temperature_read_file.rb', line 11 def initialize @temp = 0 end |
Instance Attribute Details
#temp ⇒ Object (readonly)
Returns the value of attribute temp.
9 10 11 |
# File 'lib/temperature_read_file.rb', line 9 def temp @temp end |
Class Method Details
.file_temperature(path) ⇒ Object
19 20 21 22 23 |
# File 'lib/temperature_read_file.rb', line 19 def self.file_temperature path @path = path f = File.open(path, "r") temp = f.sysread(6).to_f end |