Class: Xirr::Transaction
- Inherits:
-
Object
- Object
- Xirr::Transaction
- Defined in:
- lib/xirr/transaction.rb
Overview
A unit of the Cashflow.
Instance Attribute Summary collapse
-
#amount ⇒ Object
Returns the value of attribute amount.
-
#date ⇒ Object
Returns the value of attribute date.
Instance Method Summary collapse
-
#initialize(amount, opts = {}) ⇒ Transaction
constructor
A new instance of Transaction.
- #inspect ⇒ String
Constructor Details
#initialize(amount, opts = {}) ⇒ Transaction
Note:
Don’t forget to add date: [Date] in the opts hash.
Returns a new instance of Transaction.
12 13 14 15 16 17 18 19 |
# File 'lib/xirr/transaction.rb', line 12 def initialize(amount, opts={}) self.amount = amount # Set optional attributes.. opts.each do |key, value| send("#{key}=", value) end end |
Instance Attribute Details
#amount ⇒ Object
Returns the value of attribute amount.
5 6 7 |
# File 'lib/xirr/transaction.rb', line 5 def amount @amount end |
#date ⇒ Object
Returns the value of attribute date.
5 6 7 |
# File 'lib/xirr/transaction.rb', line 5 def date @date end |
Instance Method Details
#inspect ⇒ String
36 37 38 |
# File 'lib/xirr/transaction.rb', line 36 def inspect "T(#{@amount},#{@date})" end |