refactor: reintroduce RangeList
This commit is contained in:
parent
878c2cb95c
commit
49b541b8d9
2 changed files with 7 additions and 4 deletions
|
@ -4,11 +4,11 @@ require "./spec_helper"
|
||||||
require "../src/timecost/range_list"
|
require "../src/timecost/range_list"
|
||||||
|
|
||||||
describe TimeCost::RangeList do
|
describe TimeCost::RangeList do
|
||||||
list= TimeCost::RangeList.new
|
list = TimeCost::RangeList.new
|
||||||
|
|
||||||
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
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue