<commit_before>require "cars_api/in_memory"
require "cars_api/car_marker"

module CarsApi
  module InMemory
    # job: InMemory::CarStore understands cars data.
    class CarStore
      def initialize(data = [])
        @data = data
      end

      def get_closest(location, limit, units = :kms)
        ClosestQuery
          .new(data, location, units)
          .call(limit)
      end

      private

      attr_reader :data

      # ClosestQuery represents a get_closest query
      class ClosestQuery
        def initialize(data, location, units)
          @data = data
          @location = location
          @units = units
        end

        def call(limit)
          car_markers
            .sort_by(&:distance)
            .first(limit)
        end

        private

        attr_reader :data, :location, :units

        def car_markers
          data.map do |car|
            CarMarker.from(location, car, units)
          end
        end
      end
    end<commit_msg>Fix typo: CarMarker -> CarMarkerFactory<commit_after>require "cars_api/in_memory"
require "cars_api/car_marker"

module CarsApi
  module InMemory
    # job: InMemory::CarStore understands cars data.
    class CarStore
      def initialize(data = [])
        @data = data
      end

      def get_closest(location, limit, units = :kms)
        ClosestQuery
          .new(data, location, units)
          .call(limit)
      end

      private

      attr_reader :data

      # ClosestQuery represents a get_closest query
      class ClosestQuery
        def initialize(data, location, units)
          @data = data
          @location = location
          @units = units
        end

        def call(limit)
          car_markers
            .sort_by(&:distance)
            .first(limit)
        end

        private

        attr_reader :data, :location, :units

        def car_markers
          data.map do |car|
            CarMarkerFactory.from(location, car, units)
          end
        end
      end
    end
{'fraction_non_alphanumeric': 0.07160741111667501, 'fraction_numerical': 0.0, 'mean_word_length': 1.7146739130434783, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, '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': '4314358', 'n_tokens_mistral': 579, 'n_tokens_neox': 558, 'n_words': 152}