Instances of this class represent a catgory parsed within the !Type:Cat section of a qif file. The qiflib gem only captures the category name, and not the other fields.
Return the CSV header row.
# File lib/qiflib_category.rb, line 15 def self.csv_header CSV.generate do | csv | csv << Qiflib::csv_category_field_names end end
Constructor. The given n arg is an integer id value; defaults to 0.
# File lib/qiflib_category.rb, line 23 def initialize(n=0) @id, @name = 0, "#{n}".strip.downcase end
Return this instance an 2-element array; id and name.
# File lib/qiflib_category.rb, line 37 def as_array(idx=0) array = [] array << idx + 1 array << name array end
Return this instance a CSV row.
# File lib/qiflib_category.rb, line 29 def to_csv(idx=0) CSV.generate do | csv | csv << as_array(idx) end end