lib/sycsvpro/collector.rb
def execute
      File.new(infile).each_with_index do |line, index|
        row = row_filter.process(line, row: index)
        next if row.nil? or row.chomp.empty?
        collection.each do |category, elements|
          values = elements[:filter].process(row) 
          values.chomp.split(';').each do |value|
            elements[:entries] << value.chomp if elements[:entries].index(value.chomp).nil?
          end
        end
      end

      File.open(outfile, 'w') do |out|
        collection.each do |category, elements|
          out.puts "[#{category}]"
          elements[:entries].sort.each { |c| out.puts c }
        end
      end
    end
def execute
      File.new(infile).each_with_index do |line, index|
        row = row_filter.process(line, row: index)
        next if row.nil? or row.chomp.empty?
        collection.each do |category, elements|
          values = elements[:filter].process(row) 
          values.chomp.split(';').each do |value|
            elements[:entries] << value.chomp if elements[:entries].index(value.chomp).nil?
          end
        end
      end

      File.open(outfile, 'w') do |out|
        collection.each do |category, elements|
          out.puts "[#{category}]"
          elements[:entries].sort.each { |c| out.puts c }
        end
      end
    end
def execute File . new ( infile ) . each_with_index do | line , index | row = row_filter . process ( line , row : index ) next if row . nil? or row . chomp . empty? collection . each do | category , elements | values = elements [ :filter ] . process ( row ) values . chomp . split ( ';' ) . each do | value | elements [ :entries ] << value . chomp if elements [ :entries ] . index ( value . chomp ) . nil? end end end File . open ( outfile , 'w' ) do | out | collection . each do | category , elements | out . puts "[#{category}]" elements [ :entries ] . sort . each { | c | out . puts c } end end end
Creates a new Collector
 Execute the collector
Creates a new Collector Execute the collector