Sha256: 5d5b6351a1a555c10cd7b1b65f6ee647a7c5c9d4a9b1f6f4ab9596ff7f450c0a

Contents?: true

Size: 479 Bytes

Versions: 5

Compression:

Stored size: 479 Bytes

Contents

module Twitter
  module Enumerable
    include ::Enumerable

    # @return [Enumerator]
    def each(start = 0, &block)
      return to_enum(:each) 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, &block)
      end
      self
    end

  private

    # @return [Boolean]
    def last?
      true
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
twitter-5.7.1 lib/twitter/enumerable.rb
twitter-5.7.0 lib/twitter/enumerable.rb
twitter-5.6.0 lib/twitter/enumerable.rb
twitter-5.5.1 lib/twitter/enumerable.rb
twitter-5.5.0 lib/twitter/enumerable.rb