lib/rbbt/association/item.rb in rbbt-util-5.5.40 vs lib/rbbt/association/item.rb in rbbt-util-5.5.41

- old
+ new

@@ -41,11 +41,11 @@ value.collect{|v| Hash[*fields.zip(v).flatten] } end - def self.incidence(pairs) + def self.incidence(pairs, key_field = nil) matrix = {} targets = [] sources = [] matches = {} @@ -62,8 +62,8 @@ matches.each do |s,hash| matrix[s] = hash.values_at(*targets) end - defined?(TSV)? TSV.setup(matrix, :fields => targets, :type => :list) : matrix + defined?(TSV)? TSV.setup(matrix, :key_field => (key_field || "Source") , :fields => targets, :type => :list) : matrix end end