Sha256: 37aeb90f7d7ee1cf3e0985e3f438d6340e9234529e21b42b71276ae28e4ff887

Contents?: true

Size: 627 Bytes

Versions: 17

Compression:

Stored size: 627 Bytes

Contents

module ActsAsAccount
  class Transfer
    attr_accessor :amount, :reference, :from, :to, :journal, :valuta
  
    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
  
    def referencing_a?(klasse)
      reference.kind_of?(klasse)
    end
    
    def reverse(valuta = Time.now, reference = @reference, amount = @amount)
      @journal.transfer(
        amount,
        @to,
        @from,
        reference,
        valuta)
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
acts_as_account-3.4.2 lib/acts_as_account/transfer.rb
acts_as_account-3.4.1 lib/acts_as_account/transfer.rb
acts_as_account-3.4.0 lib/acts_as_account/transfer.rb
acts_as_account-3.3.0 lib/acts_as_account/transfer.rb
acts_as_account-3.2.3 lib/acts_as_account/transfer.rb
acts_as_account-3.2.2 lib/acts_as_account/transfer.rb
acts_as_account-3.2.1 lib/acts_as_account/transfer.rb
acts_as_account-3.2.0 lib/acts_as_account/transfer.rb
acts_as_account-3.1.2 lib/acts_as_account/transfer.rb
acts_as_account-2.0.3 lib/acts_as_account/transfer.rb
acts_as_account-3.1.1 lib/acts_as_account/transfer.rb
acts_as_account-2.0.2 lib/acts_as_account/transfer.rb
acts_as_account-3.1.0 lib/acts_as_account/transfer.rb
acts_as_account-2.0.1 lib/acts_as_account/transfer.rb
acts_as_account-1.2.0 lib/acts_as_account/transfer.rb
acts_as_account-1.1.6 lib/acts_as_account/transfer.rb
acts_as_account-1.1.5 lib/acts_as_account/transfer.rb