lib/sycsvpro/calculator.rb
def execute
      processed_header = false

      File.open(outfile, 'w') do |out|
        File.open(infile).each_with_index do |line, index|
          next if line.chomp.empty? || unstring(line).chomp.split(';').empty?

          unless processed_header
            header_row = header.process(line.chomp)
            header_row = @write_filter.process(header_row) unless @final_header
            out.puts header_row unless header_row.nil? or header_row.empty?
            processed_header = true
            next
          end

          next if row_filter.process(line, row: index).nil?

          @columns = unstring(line).chomp.split(';')
          formulae.each do |col, formula|
            @columns[col.to_i] = eval(formula)
          end
          out.puts @write_filter.process(@columns.join(';'))

          @columns.each_with_index do |column, index|
            column = 0 unless column.to_s =~ /^[\d\.,]*$/

            if @sum_row[index]
              @sum_row[index] += to_number column
            else
              @sum_row[index] =  to_number column
            end
          end if add_sum_row

        end

        out.puts @write_filter.process(@sum_row.join(';')) if add_sum_row

      end
    end
def execute
      processed_header = false

      File.open(outfile, 'w') do |out|
        File.open(infile).each_with_index do |line, index|
          next if line.chomp.empty? || unstring(line).chomp.split(';').empty?

          unless processed_header
            header_row = header.process(line.chomp)
            header_row = @write_filter.process(header_row) unless @final_header
            out.puts header_row unless header_row.nil? or header_row.empty?
            processed_header = true
            next
          end

          next if row_filter.process(line, row: index).nil?

          @columns = unstring(line).chomp.split(';')
          formulae.each do |col, formula|
            @columns[col.to_i] = eval(formula)
          end
          out.puts @write_filter.process(@columns.join(';'))

          @columns.each_with_index do |column, index|
            column = 0 unless column.to_s =~ /^[\d\.,]*$/

            if @sum_row[index]
              @sum_row[index] += to_number column
            else
              @sum_row[index] =  to_number column
            end
          end if add_sum_row

        end

        out.puts @write_filter.process(@sum_row.join(';')) if add_sum_row

      end
    end
Executes the calculator and writes the result to the _outfile_