Class: QuickETL::QifTran
- Inherits:
-
QuickETLObject
- Object
- QuickETLObject
- QuickETL::QifTran
- Defined in:
- lib/quick_etl_qif_transaction.rb
Instance Attribute Summary collapse
-
#acct_name ⇒ Object
Returns the value of attribute acct_name.
-
#acct_owner ⇒ Object
Returns the value of attribute acct_owner.
-
#acct_type ⇒ Object
Returns the value of attribute acct_type.
-
#amount ⇒ Object
Returns the value of attribute amount.
-
#balance ⇒ Object
Returns the value of attribute balance.
-
#category ⇒ Object
Returns the value of attribute category.
-
#cleared ⇒ Object
Returns the value of attribute cleared.
-
#date ⇒ Object
Returns the value of attribute date.
-
#memo ⇒ Object
Returns the value of attribute memo.
-
#number ⇒ Object
Returns the value of attribute number.
-
#payee ⇒ Object
Returns the value of attribute payee.
-
#raw_lines ⇒ Object
Returns the value of attribute raw_lines.
-
#valid ⇒ Object
Returns the value of attribute valid.
Instance Method Summary collapse
- #add_line(line) ⇒ Object
-
#initialize(anOwner, aName, aType, line_num, delim = '|') ⇒ QifTran
constructor
A new instance of QifTran.
-
#parse ⇒ Object
Field Indicator Explanations: D Date T Amount C Cleared status N Num (check or reference number) P Payee M Memo A Address (up to five lines; the sixth line is an optional message) NOT IMPLEMENTED IN QUICK-ETL L Category (Category/Subcategory/Transfer/Class) S Category in split (Category/Transfer/Class) E Memo in split $ Dollar amount of split ^ End of the entry.
- #to_s ⇒ Object
Methods included from QuickETLKernel
#command_line_arg, #command_line_array_arg, #command_line_boolean_arg, #default_delimiter, #display_general_info, #display_usage_instructions, #get_array_property, #get_property, #home_dir, #line_value, #load_properties, #parse_qif_files, #project_author, #project_copyright, #project_date, #project_embedded_comment, #project_license, #project_name, #project_version_number, #project_year, #read_as_ascii_lines, #read_lines, #startup, #strip_lines, #tokenize, #usage_instructions, #write_file, #write_lines
Constructor Details
#initialize(anOwner, aName, aType, line_num, delim = '|') ⇒ QifTran
Returns a new instance of QifTran.
20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/quick_etl_qif_transaction.rb', line 20 def initialize(anOwner, aName, aType, line_num, delim='|') @acct_owner = "#{anOwner}" @acct_name = "#{aName}" @acct_type = "#{aType}" @line_num = line_num @delim = delim @valid = false @cleared = ' ' @number = ' ' @memo = ' ' @raw_lines = Array.new @splits = Array.new end |
Instance Attribute Details
#acct_name ⇒ Object
Returns the value of attribute acct_name.
17 18 19 |
# File 'lib/quick_etl_qif_transaction.rb', line 17 def acct_name @acct_name end |
#acct_owner ⇒ Object
Returns the value of attribute acct_owner.
17 18 19 |
# File 'lib/quick_etl_qif_transaction.rb', line 17 def acct_owner @acct_owner end |
#acct_type ⇒ Object
Returns the value of attribute acct_type.
17 18 19 |
# File 'lib/quick_etl_qif_transaction.rb', line 17 def acct_type @acct_type end |
#amount ⇒ Object
Returns the value of attribute amount.
17 18 19 |
# File 'lib/quick_etl_qif_transaction.rb', line 17 def amount @amount end |
#balance ⇒ Object
Returns the value of attribute balance.
18 19 20 |
# File 'lib/quick_etl_qif_transaction.rb', line 18 def balance @balance end |
#category ⇒ Object
Returns the value of attribute category.
18 19 20 |
# File 'lib/quick_etl_qif_transaction.rb', line 18 def category @category end |
#cleared ⇒ Object
Returns the value of attribute cleared.
18 19 20 |
# File 'lib/quick_etl_qif_transaction.rb', line 18 def cleared @cleared end |
#date ⇒ Object
Returns the value of attribute date.
17 18 19 |
# File 'lib/quick_etl_qif_transaction.rb', line 17 def date @date end |
#memo ⇒ Object
Returns the value of attribute memo.
18 19 20 |
# File 'lib/quick_etl_qif_transaction.rb', line 18 def memo @memo end |
#number ⇒ Object
Returns the value of attribute number.
18 19 20 |
# File 'lib/quick_etl_qif_transaction.rb', line 18 def number @number end |
#payee ⇒ Object
Returns the value of attribute payee.
18 19 20 |
# File 'lib/quick_etl_qif_transaction.rb', line 18 def payee @payee end |
#raw_lines ⇒ Object
Returns the value of attribute raw_lines.
17 18 19 |
# File 'lib/quick_etl_qif_transaction.rb', line 17 def raw_lines @raw_lines end |
#valid ⇒ Object
Returns the value of attribute valid.
18 19 20 |
# File 'lib/quick_etl_qif_transaction.rb', line 18 def valid @valid end |
Instance Method Details
#add_line(line) ⇒ Object
36 37 38 |
# File 'lib/quick_etl_qif_transaction.rb', line 36 def add_line(line) @raw_lines.push(line) end |
#parse ⇒ Object
Field Indicator Explanations:
D Date
T Amount
C Cleared status
N Num (check or reference number)
P Payee
M Memo
A Address (up to five lines; the sixth line is an optional ) NOT IMPLEMENTED IN QUICK-ETL
L Category (Category/Subcategory/Transfer/Class)
S Category in split (Category/Transfer/Class)
E Memo in split
$ Dollar amount of split
^ End of the entry
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
# File 'lib/quick_etl_qif_transaction.rb', line 56 def parse @raw_lines.each { | line | if (line.match(/^D/)) @date = QifDate.new(line_value(line)) elsif (line.match(/^T/)) s = line_value(line) @amount = Money.new(s) elsif (line.match(/^P/)) @payee = line_value(line) elsif (line.match(/^C/)) @cleared = line_value(line) elsif (line.match(/^N/)) @number = line_value(line) elsif (line.match(/^M/)) @memo = line_value(line) elsif (line.match(/^L/)) @category = line_value(line) elsif (line.match(/^S/)) @split_category = line_value(line) elsif (line.match(/^E/)) @split_memo = line_value(line) elsif (line.match(/^$/)) @split_amount = Money.new(line_value(line)) end } if (@date && @amount && @payee) @valid = true end end |
#to_s ⇒ Object
86 87 88 |
# File 'lib/quick_etl_qif_transaction.rb', line 86 def to_s "#{@delim}#{@acct_owner}#{@delim}#{@acct_name}#{@delim}#{@acct_type}#{@delim}#{@date.ccyymmdd}#{@delim}#{@cleared}#{@delim}#{@number}#{@delim}#{@amount.to_s}#{@delim}#{@payee}#{@delim}#{@category}#{@delim}#{@memo}#{@delim}#{@line_num}" end |