Class: Ldgr::Transaction

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

Constructor Details

#initialize {|_self| ... } ⇒ Transaction

Returns a new instance of Transaction.

Yields:

  • (_self)

Yield Parameters:



17
18
19
# File 'lib/ldgr/transaction.rb', line 17

def initialize(&block)
  yield self if block_given?
end

Instance Attribute Details

#accountObject

Returns the value of attribute account.



15
16
17
# File 'lib/ldgr/transaction.rb', line 15

def 
  @account
end

#amountObject

Returns the value of attribute amount.



15
16
17
# File 'lib/ldgr/transaction.rb', line 15

def amount
  @amount
end

#clearedObject

Returns the value of attribute cleared.



15
16
17
# File 'lib/ldgr/transaction.rb', line 15

def cleared
  @cleared
end

#currencyObject

Returns the value of attribute currency.



15
16
17
# File 'lib/ldgr/transaction.rb', line 15

def currency
  @currency
end

#dateObject

Returns the value of attribute date.



15
16
17
# File 'lib/ldgr/transaction.rb', line 15

def date
  @date
end

#equityObject

Returns the value of attribute equity.



15
16
17
# File 'lib/ldgr/transaction.rb', line 15

def equity
  @equity
end

#payeeObject

Returns the value of attribute payee.



15
16
17
# File 'lib/ldgr/transaction.rb', line 15

def payee
  @payee
end

Instance Method Details

#to_sObject



21
22
23
24
25
26
27
# File 'lib/ldgr/transaction.rb', line 21

def to_s
  <<~HERE
  #{date} #{cleared}#{payee}
  #{}  #{currency}#{amount}
  #{equity}
  HERE
end