Sha256: 4ca915a4f9f867656101a2cd7f6f5396c6e3b06e493c39118186b4d6ce3eda9e

Contents?: true

Size: 531 Bytes

Versions: 4

Compression:

Stored size: 531 Bytes

Contents

require "set"
require "obst/group_by_days"

module Obst
  class LastSeen
    include Enumerable

    def initialize(**opts)
      @groups = Obst::GroupByDays.new(**opts)
    end

    def each(&block)
      return self unless block

      seen = Set.new
      @groups.each do |record|
        record.file_changes.keys.each do |file|
          if seen.include?(file)
            record.file_changes.delete(file)
          else
            seen << file
          end
        end
        block.call(record)
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
obst-0.1.10 lib/obst/last_seen.rb
obst-0.1.9 lib/obst/last_seen.rb
obst-0.1.8 lib/obst/last_seen.rb
obst-0.1.7 lib/obst/last_seen.rb