Class: Hexabat::IssueCount

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

Constant Summary collapse

ISSUES_PER_PAGE =
100

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(&issue_count_known) ⇒ IssueCount

Returns a new instance of IssueCount.



7
8
9
10
11
# File 'lib/hexabat/issue_count.rb', line 7

def initialize(&issue_count_known)
  @count_known  = issue_count_known
  @page_ranges  = { open: nil, closed: nil }
  @issue_counts = { open: {first: nil, last: nil}, closed: {first: nil, last: nil}}
end

Instance Attribute Details

#issue_countsObject (readonly)

Returns the value of attribute issue_counts.



5
6
7
# File 'lib/hexabat/issue_count.rb', line 5

def issue_counts
  @issue_counts
end

#page_rangesObject (readonly)

Returns the value of attribute page_ranges.



5
6
7
# File 'lib/hexabat/issue_count.rb', line 5

def page_ranges
  @page_ranges
end

Instance Method Details

#counted(page, state, page_range, issue_count) ⇒ Object



13
14
15
16
17
18
19
# File 'lib/hexabat/issue_count.rb', line 13

def counted(page, state, page_range, issue_count)
  check_done_counting do
    @page_ranges[state] = page_range
    @issue_counts[state][page] = issue_count
    @issue_counts[state][:last] = 0 unless page_range.multiple_pages?
  end
end