Sha256: 857fba28eb05754ea9992eb5487f696c0cce6b219f14d12c9f50dbbc6ccd3581

Contents?: true

Size: 497 Bytes

Versions: 1

Compression:

Stored size: 497 Bytes

Contents

# Transaction
# A single transaction

class Transaction

  attr_reader :debtor, :creditor, :amount

  def initialize(debtor, creditor, amount)
    @debtor = debtor
    @creditor = creditor
    @amount = amount
  end

  # Returns a transaction that is the reverse of the current one
  def reverse
    Transaction.new(@creditor, @debtor, @amount)
  end

  def ==(obj)
    (
      obj.amount == self.amount && 
      obj.creditor == self.creditor && 
      obj.debtor == self.debtor
    )
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ledgerous-0.0.1 lib/transaction.rb