refactor: reintroduce RangeList

This commit is contained in:
Glenn Y. Rolland 2023-07-12 11:37:12 +02:00
parent 878c2cb95c
commit 49b541b8d9
2 changed files with 7 additions and 4 deletions

View file

@ -8,7 +8,7 @@ describe TimeCost::RangeList do
describe ".new" do describe ".new" do
it "can be created without arguments" do it "can be created without arguments" do
assert_instance_of TimeCost::RangeList, list list.should be_a(TimeCost::RangeList)
end end
end end

View file

@ -4,7 +4,10 @@ module TimeCost
@ranges = [] of Range @ranges = [] of Range
end end
def add(range : Range) def add(commit : Commit) : RangeList
end
def add(range : Range) : RangeList
merged = false merged = false
merged_range = nil merged_range = nil
@ -34,7 +37,7 @@ module TimeCost
end end
end end
def sum def sum : Float
result = 0 result = 0
@ranges.each do |r| @ranges.each do |r|
result += r.diff result += r.diff