lib/pair_see/card.rb in pair_see-0.1.5 vs lib/pair_see/card.rb in pair_see-0.1.6
- old
+ new
@@ -1,16 +1,17 @@
module PairSee
class Card
attr_reader :card_name, :number_of_commits, :last_date
- def initialize(card_name, number_of_commits, first_date, last_date)
+ def initialize(card_name, commits)
@card_name = card_name
- @number_of_commits = number_of_commits
- @first_date, @last_date = first_date, last_date
+ @number_of_commits = commits.count
+ @first_date = commits.first.date
+ @last_date = commits.last.date
end
def duration
- (@first_date - @last_date).to_i + 1
+ (@last_date - @first_date).to_i + 1
end
def ==(other)
card_name == other.card_name
number_of_commits == other.number_of_commits