Class: SnailParser::Parser

Inherits:
CSV
  • Object
show all
Defined in:
lib/snail_parser/parser.rb

Constant Summary collapse

Column =
{
  title: :string,
  status: :string,
  beginning_at: :date,
  completed_at: :date,
  time_spent: :time
}.freeze

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ Parser

Returns a new instance of Parser.



18
19
20
21
22
23
# File 'lib/snail_parser/parser.rb', line 18

def initialize(path)
  CSV.open(path, 'r') do |f|
    f.shift # Remove header
    f.each { |row| rows << parse_row(row) }
  end
end

Class Method Details

.parse(path) ⇒ Object



14
15
16
# File 'lib/snail_parser/parser.rb', line 14

def self.parse(path)
  new(path).rows
end

Instance Method Details

#rowsObject



25
26
27
# File 'lib/snail_parser/parser.rb', line 25

def rows
  @rows ||= []
end