Class: Issuesrc::Issuers::Issues

Inherits:
Object
  • Object
show all
Defined in:
lib/issuers/issuers.rb

Overview

A generator of issues.

Reads issues from the queue passed to the constructor and yields them.

The format of each issue is specific to a particular issuer.

Instance Method Summary collapse

Constructor Details

#initialize(queue) ⇒ Issues

Returns a new instance of Issues.


74
75
76
77
78
# File 'lib/issuers/issuers.rb', line 74

def initialize(queue)
  @queue = queue
  @queue_done = false
  @cache = []
end

Instance Method Details

#eachObject


80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# File 'lib/issuers/issuers.rb', line 80

def each
  i = 0
  while i < @cache.length
    yield @cache[i]
    i += 1
  end

  while !@queue_done
    @queue.pop do |issue_page|
      if issue_page == :end
        @queue_done = true
        next
      end
      issue_page.each do |issue|
        yield issue unless issue.include? 'pull_request'
      end
    end
  end
end