Class: RubyMaat::Groupers::TeamMapper

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby_maat/groupers/team_mapper.rb

Overview

Team mapper - maps individual authors to teams

Instance Method Summary collapse

Constructor Details

#initialize(team_map_file) ⇒ TeamMapper



9
10
11
12
# File 'lib/ruby_maat/groupers/team_mapper.rb', line 9

def initialize(team_map_file)
  @team_map_file = team_map_file
  @author_to_team = load_team_mapping
end

Instance Method Details

#map(change_records) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/ruby_maat/groupers/team_mapper.rb', line 14

def map(change_records)
  change_records.map do |record|
    team_name = @author_to_team[record.author] || record.author

    # Create new record with team name instead of individual author
    ChangeRecord.new(
      entity: record.entity,
      author: team_name,
      date: record.date,
      revision: record.revision,
      message: record.message,
      loc_added: record.loc_added,
      loc_deleted: record.loc_deleted
    )
  end
end