lib/sycsvpro/unique.rb
def execute
      File.open(@outfile, 'w') do |out|
        File.open(@infile, 'r').each_with_index do |line, index|
          line = line.chomp

          next if line.empty?
          
          line = unstring(line).chomp

          extraction = col_filter.process(row_filter.process(line, row: index))

          next unless extraction

          key = @key_filter.process(line)
          
          unless @keys.include? key
            out.puts extraction
            @keys << key
          end
        end
      end
    end
def execute
      File.open(@outfile, 'w') do |out|
        File.open(@infile, 'r').each_with_index do |line, index|
          line = line.chomp

          next if line.empty?
          
          line = unstring(line).chomp

          extraction = col_filter.process(row_filter.process(line, row: index))

          next unless extraction

          key = @key_filter.process(line)
          
          unless @keys.include? key
            out.puts extraction
            @keys << key
          end
        end
      end
    end
def execute File . open ( @outfile , 'w' ) do | out | File . open ( @infile , 'r' ) . each_with_index do | line , index | line = line . chomp next if line . empty? line = unstring ( line ) . chomp extraction = col_filter . process ( row_filter . process ( line , row : index ) ) next unless extraction key = @key_filter . process ( line ) unless @keys . include? key out . puts extraction @keys << key end end end end
Creates a new Unique
   Sycsvpro::Unique.new(infile: "infile.csv",
                        outfile: "outfile.csv",
                        rows:    "1,3-4",
                        cols:    "0,2,4-6",
                        key:     "0,1").execute
 Removes the duplicates from infile and writes the result to outfile
Creates a new Unique Sycsvpro :: Unique . new ( infile : infile . csv outfile : outfile . csv rows : 1 3 - 4 cols : 0 2 4 - 6 key : 0 1 ) . execute Removes the duplicates from infile and writes the result to outfile