Class: ActsAsAccount::Transfer
- Inherits:
-
Object
- Object
- ActsAsAccount::Transfer
- Defined in:
- lib/acts_as_account/transfer.rb
Instance Attribute Summary collapse
-
#amount ⇒ Object
Returns the value of attribute amount.
-
#from ⇒ Object
Returns the value of attribute from.
-
#journal ⇒ Object
Returns the value of attribute journal.
-
#reference ⇒ Object
Returns the value of attribute reference.
-
#to ⇒ Object
Returns the value of attribute to.
-
#valuta ⇒ Object
Returns the value of attribute valuta.
Instance Method Summary collapse
-
#initialize(posting_1, posting_2) ⇒ Transfer
constructor
A new instance of Transfer.
- #referencing_a?(klasse) ⇒ Boolean
- #reverse(valuta = Time.now, reference = @reference, amount = @amount) ⇒ Object
Constructor Details
#initialize(posting_1, posting_2) ⇒ Transfer
Returns a new instance of Transfer.
5 6 7 8 9 10 |
# File 'lib/acts_as_account/transfer.rb', line 5 def initialize(posting_1, posting_2) @amount, @reference = posting_2.amount, posting_2.reference @from, @to = posting_1.account, posting_2.account @journal = posting_1.journal @valuta = posting_1.valuta end |
Instance Attribute Details
#amount ⇒ Object
Returns the value of attribute amount.
3 4 5 |
# File 'lib/acts_as_account/transfer.rb', line 3 def amount @amount end |
#from ⇒ Object
Returns the value of attribute from.
3 4 5 |
# File 'lib/acts_as_account/transfer.rb', line 3 def from @from end |
#journal ⇒ Object
Returns the value of attribute journal.
3 4 5 |
# File 'lib/acts_as_account/transfer.rb', line 3 def journal @journal end |
#reference ⇒ Object
Returns the value of attribute reference.
3 4 5 |
# File 'lib/acts_as_account/transfer.rb', line 3 def reference @reference end |
#to ⇒ Object
Returns the value of attribute to.
3 4 5 |
# File 'lib/acts_as_account/transfer.rb', line 3 def to @to end |
#valuta ⇒ Object
Returns the value of attribute valuta.
3 4 5 |
# File 'lib/acts_as_account/transfer.rb', line 3 def valuta @valuta end |
Instance Method Details
#referencing_a?(klasse) ⇒ Boolean
12 13 14 |
# File 'lib/acts_as_account/transfer.rb', line 12 def referencing_a?(klasse) reference.kind_of?(klasse) end |
#reverse(valuta = Time.now, reference = @reference, amount = @amount) ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'lib/acts_as_account/transfer.rb', line 16 def reverse(valuta = Time.now, reference = @reference, amount = @amount) @journal.transfer( amount, @to, @from, reference, valuta) end |