Sha256: 66aacdc510811e485e04fe6e1083eaad6a8d197b5d296ec7834950fdfcf79d7c

Contents?: true

Size: 490 Bytes

Versions: 54

Compression:

Stored size: 490 Bytes

Contents

module Shipit
  class OctokitIterator
    include Enumerable

    def initialize(relation = nil)
      if relation
        @response = relation.get(per_page: 100)
      else
        yield Shipit.github_api
        @response = Shipit.github_api.last_response
      end
    end

    def each(&block)
      response = @response

      loop do
        response.data.each(&block)
        return unless response.rels[:next]
        response = response.rels[:next].get
      end
    end
  end
end

Version data entries

54 entries across 54 versions & 1 rubygems

Version Path
shipit-engine-0.21.0 lib/shipit/octokit_iterator.rb
shipit-engine-0.20.1 lib/shipit/octokit_iterator.rb
shipit-engine-0.20.0 lib/shipit/octokit_iterator.rb
shipit-engine-0.19.0 lib/shipit/octokit_iterator.rb
shipit-engine-0.18.1 lib/shipit/octokit_iterator.rb
shipit-engine-0.18.0 lib/shipit/octokit_iterator.rb
shipit-engine-0.17.0 lib/shipit/octokit_iterator.rb
shipit-engine-0.16.0 lib/shipit/octokit_iterator.rb
shipit-engine-0.15.0 lib/shipit/octokit_iterator.rb
shipit-engine-0.14.0 lib/shipit/octokit_iterator.rb
shipit-engine-0.13.0 lib/shipit/octokit_iterator.rb
shipit-engine-0.12.1 lib/shipit/octokit_iterator.rb
shipit-engine-0.12.0 lib/shipit/octokit_iterator.rb
shipit-engine-0.11.0 lib/shipit/octokit_iterator.rb
shipit-engine-0.10.0 lib/shipit/octokit_iterator.rb
shipit-engine-0.9.0 lib/shipit/octokit_iterator.rb
shipit-engine-0.8.9 lib/shipit/octokit_iterator.rb
shipit-engine-0.8.8 lib/shipit/octokit_iterator.rb
shipit-engine-0.8.7 lib/shipit/octokit_iterator.rb
shipit-engine-0.8.6 lib/shipit/octokit_iterator.rb