twitter-status-bot/.gems/gems/twitter-5.11.0/lib/twitter/enumerable.rb

27 lines
482 B
Ruby
Raw Normal View History

module Twitter
module Enumerable
include ::Enumerable
# @return [Enumerator]
def each(start = 0)
return to_enum(:each, start) unless block_given?
Array(@collection[start..-1]).each do |element|
yield(element)
end
unless last?
start = [@collection.size, start].max
fetch_next_page
each(start, &Proc.new)
end
self
end
private
# @return [Boolean]
def last?
true
end
end
end