Class: GitMiner::GroupManager

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(batch_size:) ⇒ GroupManager

Returns a new instance of GroupManager.



5
6
7
8
9
10
11
12
# File 'lib/git_miner/group_manager.rb', line 5

def initialize(batch_size:)
  @batch_size = batch_size

  @author_offset = 0
  @committer_offset = 0
  @batch = 0
  @count = 0
end

Instance Attribute Details

#author_offsetObject (readonly)

Returns the value of attribute author_offset.



3
4
5
# File 'lib/git_miner/group_manager.rb', line 3

def author_offset
  @author_offset
end

#batchObject (readonly)

Returns the value of attribute batch.



3
4
5
# File 'lib/git_miner/group_manager.rb', line 3

def batch
  @batch
end

#batch_sizeObject (readonly)

Returns the value of attribute batch_size.



3
4
5
# File 'lib/git_miner/group_manager.rb', line 3

def batch_size
  @batch_size
end

#committer_offsetObject (readonly)

Returns the value of attribute committer_offset.



3
4
5
# File 'lib/git_miner/group_manager.rb', line 3

def committer_offset
  @committer_offset
end

#countObject (readonly)

Returns the value of attribute count.



3
4
5
# File 'lib/git_miner/group_manager.rb', line 3

def count
  @count
end

Instance Method Details

#advance!Object



14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/git_miner/group_manager.rb', line 14

def advance!
  @batch_size.times do
    @committer_offset += 1

    if @committer_offset > @author_offset
      @author_offset += 1
      @committer_offset = 0
    end
  end

  @count += @batch_size
  @batch += 1
end