class ActsAsAccount::Transfer

Attributes

amount[RW]
from[RW]
journal[RW]
reference[RW]
to[RW]
valuta[RW]

Public Class Methods

new(posting_1, posting_2) click to toggle source
# File lib/acts_as_account/transfer.rb, line 5
def initialize(posting_1, posting_2)
  @amount, @reference = posting_2.amount, posting_2.reference
  @from, @to = posting_1.account, posting_2.account
  @journal = posting_1.journal
  @valuta = posting_1.valuta
end

Public Instance Methods

referencing_a?(klasse) click to toggle source
# File lib/acts_as_account/transfer.rb, line 12
def referencing_a?(klasse)
  reference.kind_of?(klasse)
end
reverse(valuta = Time.now, reference = @reference, amount = @amount) click to toggle source
# File lib/acts_as_account/transfer.rb, line 16
def reverse(valuta = Time.now, reference = @reference, amount = @amount)
  @journal.transfer(
    amount,
    @to,
    @from,
    reference,
    valuta)
end