Module: DataParser
- Defined in:
- lib/caltrain/data_parser.rb
Class Method Summary collapse
Class Method Details
.data ⇒ Object
3 4 5 |
# File 'lib/caltrain/data_parser.rb', line 3 def data @data ||= {} end |
.parse(file_path) ⇒ Object
7 8 9 10 11 12 13 |
# File 'lib/caltrain/data_parser.rb', line 7 def parse(file_path) data[file_path] ||= File.read(file_path). split(/[\n\r]+/)[1..-1]. map { |line| line.gsub('"', ''). gsub(/\s+/, ' '). split(/,+/) } end |