Module: Twitter::Enumerable

Includes:
Enumerable
Included in:
Cursor, GeoResults, PremiumSearchResults, SearchResults, TrendResults
Defined in:
lib/twitter/enumerable.rb

Instance Method Summary collapse

Instance Method Details

#each(start = 0, &block) ⇒ Enumerator

Returns:

  • (Enumerator)


6
7
8
9
10
11
12
13
14
15
16
# File 'lib/twitter/enumerable.rb', line 6

def each(start = 0, &block)
  return to_enum(:each, start) unless block

  Array(@collection[start..]).each(&block)
  unless finished?
    start = [@collection.size, start].max
    fetch_next_page
    each(start, &block)
  end
  self
end