class Banks::Account
Constants
- CREDIT
Types
- DEBIT
- UNKNOWN
Attributes
balance[RW]
link[RW]
name[RW]
transactions[RW]
type[RW]
Public Instance Methods
convert_to_debit(account)
click to toggle source
# File lib/banks/account.rb, line 27 def convert_to_debit account account.type = DEBIT account.transactions.each do|transaction| transaction.amount = transaction.amount*-1 end end
merge_accounts(accounts)
click to toggle source
accounts - Array of accounts.
# File lib/banks/account.rb, line 15 def merge_accounts (accounts) @transactions = TransactionArray.new accounts.each do |account| if account.type == CREDIT convert_to_debit account end @transactions.merge_array account.transactions end @type = DEBIT transactions.sort_by_date end
to_s()
click to toggle source
# File lib/banks/account.rb, line 10 def to_s transactions.to_s end