Class: Ldgr::Transaction
- Inherits:
-
Object
- Object
- Ldgr::Transaction
- Defined in:
- lib/ldgr/transaction.rb
Overview
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.
Instance Attribute Summary collapse
-
#account ⇒ Object
Returns the value of attribute account.
-
#amount ⇒ Object
Returns the value of attribute amount.
-
#cleared ⇒ Object
Returns the value of attribute cleared.
-
#currency ⇒ Object
Returns the value of attribute currency.
-
#date ⇒ Object
Returns the value of attribute date.
-
#equity ⇒ Object
Returns the value of attribute equity.
-
#payee ⇒ Object
Returns the value of attribute payee.
Instance Method Summary collapse
-
#initialize {|_self| ... } ⇒ Transaction
constructor
A new instance of Transaction.
- #to_s ⇒ Object
Constructor Details
#initialize {|_self| ... } ⇒ Transaction
Returns a new instance of Transaction.
17 18 19 |
# File 'lib/ldgr/transaction.rb', line 17 def initialize(&block) yield self if block_given? end |
Instance Attribute Details
#account ⇒ Object
Returns the value of attribute account.
15 16 17 |
# File 'lib/ldgr/transaction.rb', line 15 def account @account end |
#amount ⇒ Object
Returns the value of attribute amount.
15 16 17 |
# File 'lib/ldgr/transaction.rb', line 15 def amount @amount end |
#cleared ⇒ Object
Returns the value of attribute cleared.
15 16 17 |
# File 'lib/ldgr/transaction.rb', line 15 def cleared @cleared end |
#currency ⇒ Object
Returns the value of attribute currency.
15 16 17 |
# File 'lib/ldgr/transaction.rb', line 15 def currency @currency end |
#date ⇒ Object
Returns the value of attribute date.
15 16 17 |
# File 'lib/ldgr/transaction.rb', line 15 def date @date end |
#equity ⇒ Object
Returns the value of attribute equity.
15 16 17 |
# File 'lib/ldgr/transaction.rb', line 15 def equity @equity end |
#payee ⇒ Object
Returns the value of attribute payee.
15 16 17 |
# File 'lib/ldgr/transaction.rb', line 15 def payee @payee end |
Instance Method Details
#to_s ⇒ Object
21 22 23 24 25 26 27 |
# File 'lib/ldgr/transaction.rb', line 21 def to_s <<~HERE #{date} #{cleared}#{payee} #{account} #{currency}#{amount} #{equity} HERE end |