Sha256: 7e42abdf5cc75cb47cb9c7914d2566f1d28ba179adde1029255cc67f6e58c1ff

Contents?: true

Size: 732 Bytes

Versions: 1

Compression:

Stored size: 732 Bytes

Contents

module PairSee
  class Card
    attr_reader :card_name, :number_of_commits, :last_date

    def initialize(card_name, commits)
      @card_name = card_name
      @number_of_commits = commits.count
      @first_date = commits.first.date
      @last_date = commits.last.date
    end

    def duration
      (@last_date - @first_date).to_i + 1
    end

    def ==(other)
      card_name == other.card_name
      number_of_commits == other.number_of_commits
    end

    def pretty
      commits_per_day = ((number_of_commits * 1.0) / duration).round(2)
      "#{card_name} - - - commits: #{number_of_commits} - - - duration: #{duration} days - - - last commit: #{last_date} - - - commits per day: #{commits_per_day}"
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pair_see-0.1.6 lib/pair_see/card.rb