Class: LedgerTillerExport::Row

Inherits:
T::Struct
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/ledger_tiller_export.rb

Class Method Summary collapse

Class Method Details

.from_csv_row(row) ⇒ Object



23
24
25
26
27
28
29
30
31
# File 'lib/ledger_tiller_export.rb', line 23

def self.from_csv_row(row)
  new(
    txn_date: Date.strptime(T.must(row["Date"]), "%m/%d/%Y"),
    txn_id: T.must(row['Transaction ID']),
    account: T.must(row['Account']),
    amount: T.must(row["Amount"]).gsub('$', '').gsub(',', '').to_f,
    description: T.must(row['Description']).gsub(/\+? /, '').capitalize,
  )
end