Sha256: ffcda93d76443753c733810a0051e03872d2794197e12159cc9f7ea732b35e23

Contents?: true

Size: 828 Bytes

Versions: 1

Compression:

Stored size: 828 Bytes

Contents

module PairSee
  class LogLines
    require_relative 'log_line'
    require 'git'

    include Enumerable

    def initialize(lines)
      @lines = lines
    end

    def each(&block)
      lines.each &block
    end

    def last
      lines.last
    end

    def active?(person)
      any? do |log_line|
        log_line.authored_by?(person)
      end
    end

    def commits_for_pair(person1, person2)
      select {|log_line| log_line.authored_by?(person1, person2)}
    end

    def commits_not_by_known_pair(devs)
      reject {|log_line| log_line.by_any? devs}
    end

    def solo_commits(people, person)
      select do |log_line|
        log_line.authored_by?(person) && (people - [person]).none? {|single_person| log_line.authored_by?(single_person)}
      end
    end

    private

    attr_reader :lines
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pair_see-0.1.5 lib/pair_see/log_lines.rb