Class: Volksbanker::Line

Inherits:
Object
  • Object
show all
Defined in:
lib/volksbanker/line.rb

Direct Known Subclasses

Balance, Transaction

Constant Summary collapse

DATE_FORMAT =
'%d.%m.%Y'

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.parse(str) ⇒ Object



7
8
9
# File 'lib/volksbanker/line.rb', line 7

def self.parse(str)
  CSV.parse(str, col_sep: ';') { |row| return new(*row) }
end

Instance Method Details

#parse_amount(amt, dir) ⇒ Object



15
16
17
18
19
# File 'lib/volksbanker/line.rb', line 15

def parse_amount(amt, dir)
  amount = parse_number amt
  amount *= -1 unless credit?(dir)
  amount
end

#parse_date(str) ⇒ Object



11
12
13
# File 'lib/volksbanker/line.rb', line 11

def parse_date(str)
  Date.strptime str, DATE_FORMAT if str
end