lib/coco/cover/coverage_result.rb in coco-0.10.0 vs lib/coco/cover/coverage_result.rb in coco-0.11.0

- old
+ new

@@ -18,11 +18,11 @@ # Public: Initialize a CoverageResult. # # config - Hash # raw_results - Hash results obtained from Coverage.result. - def initialize config, raw_results + def initialize(config, raw_results) @exclude_files = config[:excludes] @threshold = config[:threshold] raise ArgumentError if @threshold < 0 @result = raw_results exclude_external_sources @@ -32,23 +32,23 @@ private def exclude_external_sources here = Dir.pwd - @all_from_domain = @result.select {|key, value| key.start_with? here} + @all_from_domain = @result.select {|key, value| key.start_with?(here) } end def exclude_files_user_dont_want return if @exclude_files.nil? @exclude_files.each do |filename| @all_from_domain.delete(File.expand_path(filename)) end end def exclude_sources_above_threshold - @covered_from_domain = @all_from_domain.select {|key, value| + @covered_from_domain = @all_from_domain.select do |key, value| CoverageStat.coverage_percent(value) < @threshold - } + end end end end