Sha256: 28c83f4d808bd7aeba72ab568e0ebce8cc676dc31bda9c3f953d3704fecfb423
Contents?: true
Size: 594 Bytes
Versions: 2
Compression:
Stored size: 594 Bytes
Contents
module Twitter module Enumerable include ::Enumerable # @return [Enumerator] 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 private # @return [Boolean] def last? true end # @return [Boolean] def reached_limit? false end # @return [Boolean] def finished? last? || reached_limit? end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
twitter-8.1.0 | lib/twitter/enumerable.rb |
twitter-8.0.1 | lib/twitter/enumerable.rb |