Module: Hakoy::FileAppender::Csv::DuplicatesFilter
- Defined in:
- lib/hakoy/file_appender/csv.rb
Class Method Summary collapse
Class Method Details
.call(file_path, rows_hash, uid_key) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/hakoy/file_appender/csv.rb', line 8 def call(file_path, rows_hash, uid_key) results = [] check_duplidate = -> (row) do rows_hash.each do |row_hash| unless row[uid_key] == row_hash[uid_key] results << row_hash end end end CSV.foreach(file_path, headers: true, &check_duplidate) results end |