Class: Transformers::Formatters::Wise
- Defined in:
- lib/ynab_convert/transformers/formatters/wise_formatter.rb
Overview
Wise card accounts formatter
Instance Method Summary collapse
-
#initialize ⇒ Wise
constructor
A new instance of Wise.
- #memo(row) ⇒ Object
- #payee(row) ⇒ Object
Methods inherited from Formatter
Constructor Details
#initialize ⇒ Wise
Returns a new instance of Wise.
7 8 9 |
# File 'lib/ynab_convert/transformers/formatters/wise_formatter.rb', line 7 def initialize super({ date: [1], payee: [13], amount: [2] }) end |
Instance Method Details
#memo(row) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/ynab_convert/transformers/formatters/wise_formatter.rb', line 20 def memo(row) # Description goes in Memo because we'll need to extract the original # amount from it in the enhancer. description = row[4] amount_currency = row[3] original_amount = description.scan(/\d+\.\d{2}\s\w{3}/).first memo = amount_currency # Topups don't have an original amount memo = "#{memo},#{original_amount}" unless original_amount.nil? memo end |
#payee(row) ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'lib/ynab_convert/transformers/formatters/wise_formatter.rb', line 11 def payee(row) merchant = row[13] description = row[4] return description if merchant.nil? merchant end |