Class: FileReader
- Inherits:
-
Object
- Object
- FileReader
- Defined in:
- lib/file_reader.rb
Class Method Summary collapse
-
.file_open(path) ⇒ Object
Reads temperature in degrees celcius from a .txt file Reads one line at a time and converts to float.
Class Method Details
.file_open(path) ⇒ Object
Reads temperature in degrees celcius from a .txt file Reads one line at a time and converts to float
6 7 8 9 10 11 12 13 |
# File 'lib/file_reader.rb', line 6 def self.file_open(path) File.open(path, "r") do |f| f.each_line do |line| temperature = line.to_f return temperature end end end |