lib/rbbt/util/tsv/index.rb in rbbt-util-3.0.3 vs lib/rbbt/util/tsv/index.rb in rbbt-util-3.1.0
- old
+ new
@@ -32,10 +32,11 @@
values.each_with_index do |list,i|
list = [list] unless Array === list
i += 1 if fields.nil?
list.each do |elem|
+ next if elem.empty?
elem.downcase if case_insensitive
new[elem] ||= []
new[elem][i] ||= []
new[elem][i].concat keys
end
@@ -71,10 +72,11 @@
else
list = values.flatten unless type == :flat
end
list.collect!{|e| e.downcase} if case_insensitive
list.each do |elem|
+ next if elem.empty?
new[elem] ||= []
if double_keys
new[elem].concat key
else
new[elem] << key
@@ -231,9 +233,11 @@
new
end
def self.field_matches(tsv, values)
values = [values] if not Array === values
+ Log.debug "Matcing #{values.length} values to #{tsv.filename}"
+
if values.flatten.sort[0..9].compact.collect{|n| n.to_i} == (1..10).to_a
return {}
end
key_field = tsv.key_field