Class: FileReader

Inherits:
Object
  • Object
show all
Defined in:
lib/reader/file_reader.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(filename) ⇒ FileReader

Returns a new instance of FileReader.



5
6
7
8
# File 'lib/reader/file_reader.rb', line 5

def initialize(filename)
    contents = File.open(filename, 'rb') { |f| f.read }
    @temperature = contents.to_f
end

Instance Attribute Details

#temperatureObject (readonly)

Returns the value of attribute temperature.



3
4
5
# File 'lib/reader/file_reader.rb', line 3

def temperature
  @temperature
end