Sha256: e10e3dfe5198605fc5bda405f27de226c418b5208dfd61ca0c6a8a0b4f6ef246

Contents?: true

Size: 468 Bytes

Versions: 2

Compression:

Stored size: 468 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

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
twitter-5.4.1 lib/twitter/enumerable.rb
twitter-5.4.0 lib/twitter/enumerable.rb