class Reader
Public Class Methods
new(files,opt)
click to toggle source
# File lib/csv_combine.rb, line 24 def initialize(files,opt) @files = files @opt = opt end
Public Instance Methods
each() { |row| ... }
click to toggle source
# File lib/csv_combine.rb, line 29 def each hash_list = [] @files.each do |file| reader = CSV.open(file,"r") reader.shift if @opt[:skip_header_files].class == Array && @opt[:skip_header_files].index(file) reader.shift if @opt[:skip_header_files] == file reader.each do |row| if @opt[:uniq] hash = Digest::SHA1.new.update(row.to_s).to_s yield row unless hash_list.index(hash) hash_list << hash else yield row end end end end