class Suspect::Prediction::Naive::AllFound

Attributes

file_tree[R]
run_infos[R]

Public Class Methods

new(run_infos, file_tree) click to toggle source
# File lib/suspect/prediction/naive/all_found.rb, line 5
def initialize(run_infos, file_tree)
  @run_infos = run_infos
  @file_tree = file_tree
end

Public Instance Methods

match?(first_array, second_array) click to toggle source
# File lib/suspect/prediction/naive/all_found.rb, line 23
def match?(first_array, second_array)
  (first_array & second_array).any?
end
paths() click to toggle source
# File lib/suspect/prediction/naive/all_found.rb, line 10
def paths
  result = []
  return result if modified_files.empty?

  run_infos.foreach do |run_info|
    if match?(modified_files, run_info.modified_files)
      result.push *run_info.failed_files
    end
  end

  select_existing_files(result.uniq)
end

Private Instance Methods

modified_files() click to toggle source
# File lib/suspect/prediction/naive/all_found.rb, line 31
def modified_files
  @modified_files ||= file_tree.modified_files
end
select_existing_files(files) click to toggle source
# File lib/suspect/prediction/naive/all_found.rb, line 35
def select_existing_files(files)
  files & file_tree.files
end