lib/differential/parser/reader.rb in differential-1.0.2 vs lib/differential/parser/reader.rb in differential-1.0.3
- old
+ new
@@ -32,11 +32,13 @@
end
def each(hashes)
return enum_for(:each) unless block_given?
- hashes.each do |hash|
+ array(hashes).each do |hash|
+ next unless hash
+
record = read(hash)
yield record
end
end
@@ -65,9 +67,17 @@
@record_id_key_array ||= Array(record_id_key)
end
def group_id_key_array
@group_id_key_array ||= Array(group_id_key)
+ end
+
+ def array(hashes)
+ if hashes.is_a?(Hash)
+ [hashes]
+ else
+ Array(hashes)
+ end
end
end
end
end