Class: FileReader
- Inherits:
-
Object
- Object
- FileReader
- Defined in:
- lib/reader/file_reader.rb
Instance Attribute Summary collapse
-
#temperature ⇒ Object
readonly
Returns the value of attribute temperature.
Instance Method Summary collapse
-
#initialize(filename) ⇒ FileReader
constructor
A new instance of FileReader.
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
#temperature ⇒ Object (readonly)
Returns the value of attribute temperature.
3 4 5 |
# File 'lib/reader/file_reader.rb', line 3 def temperature @temperature end |