class Financier::Transaction
Attributes
amount[R]
date[R]
Public Class Methods
new(amount, date = Date[Time.now])
click to toggle source
# File lib/financier/transaction.rb, line 6 def initialize(amount, date = Date[Time.now]) send(:amount=, amount) send(:date=, date) end
Public Instance Methods
after?(other_date)
click to toggle source
# File lib/financier/transaction.rb, line 31 def after?(other_date) date > other_date.to_date end
amount=(value)
click to toggle source
# File lib/financier/transaction.rb, line 11 def amount=(value) @amount = Flt::DecNum.new(value.to_s).round(2) end
before?(other_date)
click to toggle source
# File lib/financier/transaction.rb, line 27 def before?(other_date) date < other_date.to_date end
credit?()
click to toggle source
# File lib/financier/transaction.rb, line 15 def credit? amount.positive? end
date=(value)
click to toggle source
# File lib/financier/transaction.rb, line 19 def date=(value) @date = value.to_date end
debit?()
click to toggle source
# File lib/financier/transaction.rb, line 35 def debit? amount.negative? end
on?(other_date)
click to toggle source
# File lib/financier/transaction.rb, line 23 def on?(other_date) date === other_date.to_date end
to_s()
click to toggle source
# File lib/financier/transaction.rb, line 43 def to_s amount.to_s end
zero?()
click to toggle source
# File lib/financier/transaction.rb, line 39 def zero? amount.zero? end