Module: Twitter::Enumerable

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

Instance Method Summary (collapse)

Instance Method Details

- (Enumerator) each(start = 0)

Returns:

  • (Enumerator)


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

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