Class: CsvReader
- Inherits:
-
Object
- Object
- CsvReader
- Defined in:
- lib/stockStats/csv_reader.rb
Constant Summary collapse
- @@sum =
0
Instance Method Summary collapse
Instance Method Details
#read_in_csv_data(csv_file_name) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/stockStats/csv_reader.rb', line 6 def read_in_csv_data(csv_file_name) count = CSV.foreach(csv_file_name).inject(0) { | c, line | c + 1 } libros = CSV.open(csv_file_name).each count.times { @@sum += libros.next[2].to_f } end |
#total_value_in_stock ⇒ Object
19 20 21 22 23 |
# File 'lib/stockStats/csv_reader.rb', line 19 def total_value_in_stock @@sum end |