class Ldgr::Transaction
Builds a transaction
Examples
Transaction.new do |t| t.payee = "Something" t.amount = 1000 t.date = Date.today + 1 end # => <class Transaction @payee="Something", @amount=1000, @date=Date.today + 1>
Returns a transaction.
Attributes
account[RW]
amount[RW]
cleared[RW]
currency[RW]
date[RW]
effective[RW]
equity[RW]
payee[RW]
Public Class Methods
new() { |self| ... }
click to toggle source
# File lib/ldgr/transaction.rb, line 18 def initialize(&block) yield self if block_given? end
Public Instance Methods
to_s()
click to toggle source
# File lib/ldgr/transaction.rb, line 22 def to_s <<~HERE #{date} #{cleared}#{payee} #{account} #{currency}#{amount} #{equity} HERE end
valid?()
click to toggle source
# File lib/ldgr/transaction.rb, line 30 def valid? return false if String(payee).empty? return false if String(amount).empty? return false if String(account).empty? true end