Add Hash support to fetch_all (#586)

This commit aligns the behavior of `fetch_all` over map responses with
that of arrays (returning a single collection with all entries).
This commit is contained in:
Sai Cheemalapati authored and GitHub committed 2017-06-01 23:52:09 -04:00
1 parent 9237ba59cb
commit e3792b19d2
2 files changed
+13 -3

No files matched your search

+6
View File
@@ -69,6 +69,12 @@ module Google
break if @max && item_count > @max
yield item
end
elsif items.kind_of?(Hash)
items.each do |key, val|
item_count = item_count + 1
break if @max && item_count > @max
yield key, val
end
elsif items
# yield singular non-nil items (for genomics API)
yield items