<commit_before>class RouteService
  attr_reader :origin, :destination, :paths

  def initialize(origin, destination)
    @origin = origin
    @destination = destination
    @paths = []
  end

  def find_shortest
    load_paths(origin) if @paths.blank?

    path = shortest_path

    return path if path.end == destination

    load_paths(path.end, path)

    remove_path(path)

    find_shortest
  end

  def load_paths(point, path = nil)
    Distance.where(origin: point).each do |distance|
      @paths << Path.new(distance, path)
    end
  end

  def remove_path(path)
    @paths.delete(path)
  end

  def shortest_path
    @paths.sort_by(&:distance).first
  end
end
<commit_msg>Change RouteService#load_paths to private<commit_after>class RouteService
  attr_reader :origin, :destination, :paths

  def initialize(origin, destination)
    @origin = origin
    @destination = destination
    @paths = []
  end

  def find_shortest
    load_paths(origin) if @paths.blank?

    path = shortest_path

    return path if path.end == destination

    load_paths(path.end, path)

    remove_path(path)

    find_shortest
  end

  def remove_path(path)
    @paths.delete(path)
  end

  def shortest_path
    @paths.sort_by(&:distance).first
  end

  private

  def load_paths(point, path = nil)
    Distance.where(origin: point).each do |distance|
      @paths << Path.new(distance, path)
    end
  end
end

{'fraction_non_alphanumeric': 0.09337134711332858, 'fraction_numerical': 0.0, 'mean_word_length': 3.2545454545454544, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6317883', 'n_tokens_mistral': 467, 'n_tokens_neox': 439, 'n_words': 112}