Class: PairSee::PairRecency

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

Instance Method Summary collapse

Constructor Details

#initialize(log_lines, card_prefixes, people) ⇒ PairRecency

Returns a new instance of PairRecency.



3
4
5
6
7
# File 'lib/pair_see/pair_recency.rb', line 3

def initialize(log_lines, card_prefixes, people)
  @log_lines = log_lines
  @card_prefixes = card_prefixes
  @people = people
end

Instance Method Details

#pair_recencyObject



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/pair_see/pair_recency.rb', line 9

def pair_recency
  pairing_events = @people.map do |current_person|
    my_commits = @log_lines.select { |ll| ll.authored_by?(current_person) }

    most_recent_commits = {}
    @people.map do |pair|
      my_commits.each do |ll|
        if pair.display_name != current_person.display_name && ll.authored_by?(pair)
          most_recent_commits[pair] = [ll, pair] # TODO: make [ll, pair] and object? or make ll know devs in ll?
        end
      end
    end
    PairingEvent.new(current_person, most_recent_commits)
  end

  pairing_events.map(&:pretty) # TODO: make an object which extends Enum and holds pairing events
end