module MissCleo::CoverageFilter

Constants

GEM_PATHS
RUBY_PATH

Public Instance Methods

filter_and_trim(result_hash) click to toggle source
# File lib/miss_cleo/coverage_filter.rb, line 24
def filter_and_trim(result_hash)
  filtered = filter_core(result_hash)
  normalize_paths(filtered)
end
filter_core(result_hash) click to toggle source
# File lib/miss_cleo/coverage_filter.rb, line 7
def filter_core(result_hash)
  # Don't include gems in coverage map
  result_hash.reject do |file, line|
    ([RUBY_PATH] + GEM_PATHS).any? { |path| file.include?(path) }
  end
end
normalize_paths(result_hash) click to toggle source
# File lib/miss_cleo/coverage_filter.rb, line 14
def normalize_paths(result_hash)
  normalized_hash = Hash.new
  result_hash.each do |key, value|
    trimmed_key = key.gsub(/#{Regexp.quote(`pwd`.chomp)}\//, "")
    normalized_hash[trimmed_key] = value
  end

  normalized_hash
end