Sha256: beb85a2842c56785e6a15012b47137530bdfcac4ad37b1acf805d7b49fa388e5
Contents?: true
Size: 627 Bytes
Versions: 1
Compression:
Stored size: 627 Bytes
Contents
# frozen_string_literal: true module BAI2 class Account attr_reader :header, :transactions, :trailer def initialize(header, transactions, trailer = nil) @header = header @transactions = transactions @trailer = trailer end def set_trailer(trailer) raise BAI2::Error, "Trailer has already been set" if @trailer @trailer = trailer end def total_credits transactions.select(&:credit?).sum(&:amount) end def total_debits transactions.select(&:debit?).sum(&:amount) end def net_total transactions.sum(&:signed_amount) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
bai2_ruby-0.1.0 | lib/bai2_ruby/account.rb |