From d5d04412b67597997791e3286dca3d6a7516867b Mon Sep 17 00:00:00 2001 From: "Glenn Y. Rolland" Date: Tue, 26 Sep 2017 07:49:21 +0200 Subject: [PATCH] Fix bugs related to input ranges --- Gemfile | 2 ++ lib/timecost/cli.rb | 14 ++++++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/Gemfile b/Gemfile index d924a13..d07ccb8 100644 --- a/Gemfile +++ b/Gemfile @@ -1,5 +1,7 @@ # A sample Gemfile source "https://rubygems.org" +# gem "pry" + # Specify your gem's dependencies in timecost.gemspec gemspec diff --git a/lib/timecost/cli.rb b/lib/timecost/cli.rb index c2e96c3..3830fe1 100644 --- a/lib/timecost/cli.rb +++ b/lib/timecost/cli.rb @@ -174,12 +174,18 @@ module TimeCost def analyze_dumps #read ranges - @rangelist = RangeList.new @config[:input_dump].each do |filename| - rangelist = YAML::load(File.open(filename,"r")) - rangelist.each do |range| - @rangelist.add range + filelists = YAML::load(File.open(filename,"r")) + # require 'pry' + # binding.pry + filelists.each do |author, rangelist| + # create list if author is new + @rangelist[author] ||= RangeList.new + + rangelist.each do |range| + @rangelist[author].add range + end end end end