class BankStatementParser::StatementRecord
A bank statement record
Attributes
amount[RW]
balance[RW]
credit[RW]
date[RW]
detail[RW]
record_type[RW]
type[RW]
Public Class Methods
new(date: nil, type: nil, record_type: nil, credit: nil, amount: nil, detail: nil, balance: nil)
click to toggle source
Constructor
# File lib/bank_statement_parser/statement_record.rb, line 28 def initialize date: nil, type: nil, record_type: nil, credit: nil, amount: nil, detail: nil, balance: nil # Sanity check the record type parameter known_record_types = StatementRecordTypes.constants(false).map do |k| StatementRecordTypes.const_get(k, false) end raise "Unknown statement record type #{record_type}" unless known_record_types.include?(record_type) @date = date @type = type @record_type = record_type @credit = credit @amount = amount @detail = detail @balance = balance end
Public Instance Methods
==(other)
click to toggle source
Equality test
Calls superclass method
# File lib/bank_statement_parser/statement_record.rb, line 53 def ==(other) super || (date == other.date && type == other.type && record_type == other.record_type && credit == other.credit && amount == other.amount && detail == other.detail && balance == other.balance) end
to_s()
click to toggle source
Stringify
# File lib/bank_statement_parser/statement_record.rb, line 48 def to_s to_yaml end