class Banco::Transaction

Attributes

csv_row_count[R]
date[R]
description[R]
moneyin[R]
moneyout[R]
type[R]

Public Class Methods

new(date_string, description, type, moneyin, moneyout, csv_row_count) click to toggle source
# File lib/banco/transaction.rb, line 7
def initialize(date_string, description, type, moneyin, moneyout, csv_row_count)
  @csv_row_count = csv_row_count
  @moneyin = convert(moneyin)
  @moneyout = convert(moneyout)
  @date = date_string
  @description = format('%-22.22s', description.upcase.to_s)
  @type = format('%-8.8s', type.upcase.to_s)
end

Public Instance Methods

convert(money) click to toggle source
# File lib/banco/transaction.rb, line 16
def convert(money)
  money.nil? ? BigDecimal('0') : BigDecimal(money)
end
to_s() click to toggle source
# File lib/banco/transaction.rb, line 20
def to_s
  "#{date} #{type} #{description}"
end