Method: Zold::Patch#legacy
- Defined in:
- lib/zold/patch.rb
#legacy(wallet, hours: 24) ⇒ Object
Add legacy transactions first, since they are negative and can’t be deleted ever. This method is called by merge.rb in order to add legacy negative transactions to the patch before everything else. They are not supposed to be disputed, ever.
51 52 53 54 55 56 |
# File 'lib/zold/patch.rb', line 51 def legacy(wallet, hours: 24) raise 'You can\'t add legacy to a non-empty patch' unless @id.nil? wallet.txns.each do |txn| @txns << txn if txn.amount.negative? && txn.date < Time.now - hours * 60 * 60 end end |