Sha256: f5e643c7404cfecee9633ed6ca25c173eff8e0cad365567c3efc28850a419ac0

Contents?: true

Size: 326 Bytes

Versions: 1

Compression:

Stored size: 326 Bytes

Contents

module MT940Structured::Parsers
  module BalanceParser
    def parse_balance(line)
      currency = line[12..14]
      balance_date = parse_date(line[6..11])
      type = line[5] == 'D' ? -1 : 1
      amount = line[15..-1].gsub(",", ".").to_f * type
      MT940::Balance.new(amount, balance_date, currency)
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
zilverline-mt940-2.0 lib/mt940_structured/parsers/balance_parser.rb