lib/sycsvpro/calculator.rb
def create_calculator(code)
        code.split(/,(?=\d+:)/).each do |operation|
          col, term = operation.split(':', 2)
          term = "c#{col}#{term}" if term =~ /^[+\-*\/%]/
          formulae[col] = term
        end
      end
def create_calculator(code)
        code.split(/,(?=\d+:)/).each do |operation|
          col, term = operation.split(':', 2)
          term = "c#{col}#{term}" if term =~ /^[+\-*\/%]/
          formulae[col] = term
        end
      end
def create_calculator ( code ) code . split ( / \d / ) . each do | operation | col , term = operation . split ( ':' , 2 ) term = "c#{col}#{term}" if term =~ / \- \/ / formulae [ col ] = term end end
given a csv file with a;b;c
 code is in the form of
 1:*2,2:*c3-1,4:c1+1
 1:*2 means multiply value from column 1 by 2 and assign it to column 1 c[1] = c[1]*2
 2:*c3-1 means multiply value from column 2 with value from column 3, subtract 1 and assign
 the result to column 2 c[2] = c[2] * c[3] - 1
 4:c1+1 means create a new column and assign to it the result of the sum of the value of
 column 1 + 1 c[4] = c[1] + 1
given a csv file with a ; b ; c code is in the form of 1 : * 2 2 : * c3 - 1 4 : c1 + 1 1 : * 2 means multiply value from column 1 by 2 and assign it to column 1 c [ 1 ] = c [ 1 ] * 2 2 : * c3 - 1 means multiply value from column 2 with value from column 3 subtract 1 and assign the result to column 2 c [ 2 ] = c [ 2 ] * c [ 3 ] - 1 4 : c1 + 1 means create a new column and assign to it the result of the sum of the value of column 1 + 1 c [ 4 ] = c [ 1 ] + 1