Sha256: 6f82bf44e892dbe1352b78b16fa9156c157c300ad05da241a983b8a93a087490

Contents?: true

Size: 796 Bytes

Versions: 2

Compression:

Stored size: 796 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?(dev)
      any? do |log_line|
        log_line.authored_by?(dev)
      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.not_by_pair? devs }
    end

    def solo_commits(devs, dev)
      select do |log_line|
        log_line.authored_by?(dev) && (devs - [dev]).none? { |d| log_line.authored_by?(d) }
      end
    end

    private

    attr_reader :lines
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
pair_see-0.1.4 lib/pair_see/log_lines.rb
pair_see-0.1.3 lib/pair_see/log_lines.rb