Sha256: 481cd499bc4c1f2fdc94d300fd98735ab79a07629f89f042d14b315e4a709962

Contents?: true

Size: 568 Bytes

Versions: 2

Compression:

Stored size: 568 Bytes

Contents

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
acts_as_account-1.1.1 lib/acts_as_account/transfer.rb
acts_as_account-1.1.0 lib/acts_as_account/transfer.rb