lib/qif/transaction.rb
def to_s(format = 'dd/mm/yyyy')
      SUPPORTED_FIELDS.collect do |k,v|
        next unless current = instance_variable_get("@#{k}")
        field = v.keys.first
        case current.class.to_s
        when "Time", "Date", "DateTime"
          "#{field}#{DateFormat.new(format).format(current)}"
        when "Float"
          "#{field}#{'%.2f'%current}"
        when "String"
          current.split("\n").collect {|x| "#{field}#{x}" }
        else
          "#{field}#{current}"
        end
      end.concat(@splits.collect{|s| s.to_s}).flatten.compact.join("\n")
    end
def to_s(format = 'dd/mm/yyyy')
      SUPPORTED_FIELDS.collect do |k,v|
        next unless current = instance_variable_get("@#{k}")
        field = v.keys.first
        case current.class.to_s
        when "Time", "Date", "DateTime"
          "#{field}#{DateFormat.new(format).format(current)}"
        when "Float"
          "#{field}#{'%.2f'%current}"
        when "String"
          current.split("\n").collect {|x| "#{field}#{x}" }
        else
          "#{field}#{current}"
        end
      end.concat(@splits.collect{|s| s.to_s}).flatten.compact.join("\n")
    end
def to_s ( format = 'dd/mm/yyyy' ) SUPPORTED_FIELDS . collect do | k , v | next unless current = instance_variable_get ( "@#{k}" ) field = v . keys . first case current . class . to_s when "Time" , "Date" , "DateTime" "#{field}#{DateFormat.new(format).format(current)}" when "Float" "#{field}#{'%.2f'%current}" when "String" current . split ( "\n" ) . collect { | x | "#{field}#{x}" } else "#{field}#{current}" end end . concat ( @splits . collect { | s | s . to_s } ) . flatten . compact . join ( "\n" ) end
Returns a representation of the transaction as it
 would appear in a qif file.
Returns a representation of the transaction as it would appear in a qif file .