Sha256: eb435bd125a5e62189172115c49b691dd88a35240c0b89f3d9567ce4eaa79b6f

Contents?: true

Size: 668 Bytes

Versions: 1

Compression:

Stored size: 668 Bytes

Contents

require "obst/last_seen"

module Obst
  class LongTimeNoSee
    def initialize(**opts)
      opts = opts.merge(days: 7)
      @weekly = LastSeen.new(**opts)
    end

    def to_s
      @buffer = ["# Long time no see\n"]
      @weekly.each_with_index do |record, i|
        @buffer << "- #{record.time} #{week_count(i)} (#{record.file_changes.count})"
        list_files(record)
      end
      @buffer.join("\n")
    end

    def list_files(record)
      record.group_inlines do |line|
        @buffer << "\t- #{line}"
      end
    end

    def week_count(i)
      return 'today' if i == 0
      return '1.week.ago' if i == 1
      "#{i}.weeks.ago"
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
obst-0.1.7 lib/obst/long_time_no_see.rb