lib/twitter/rest/timelines.rb in twitter-6.2.0 vs lib/twitter/rest/timelines.rb in twitter-7.0.0
- old
+ new
@@ -186,9 +186,10 @@
# @param max_id [Integer, NilClass]
# @return [Array<Twitter::Tweet>]
def collect_with_max_id(collection = [], max_id = nil, &block)
tweets = yield(max_id)
return collection if tweets.nil?
+
collection += tweets
tweets.empty? ? collection.flatten : collect_with_max_id(collection, tweets.last.id - 1, &block)
end
end
end