lib/cevennes.rb in cevennes-0.12.0 vs lib/cevennes.rb in cevennes-0.13.0

- old
+ new

@@ -2,11 +2,11 @@ require 'csv' module Cevennes - VERSION = '0.12.0' + VERSION = '0.13.0' class << self def diff(id, csv0, csv1) @@ -42,13 +42,18 @@ [ [ 'keys', ks0, ks1 ], [ 'stats', s ] ] + d end protected + def strip(row) + + row.collect { |cell| cell.is_a?(String) ? cell.strip : cell } + end + def hash(version, id, csv) csva = ::CSV.parse(reencode(csv)) - .each_with_index.collect { |row, i| [ 1 + i, row ] } + .each_with_index.collect { |row, i| [ 1 + i, strip(row) ] } .reject { |i, row| row.compact.empty? } .drop_while { |i, row| ! row.include?(id) } fail ::IndexError.new("id #{id.inspect} not found in #{version} CSV") \ if csva.empty?