<commit_before>require 'singleton'

module Proj
  class Config
    include Singleton

    def proj_lib
      ENV['PROJ_LIB'] || find_path
    end

    def search_paths
      ['/usr/share/proj',
       '/usr/local/share/proj',
       '/opt/share/proj',
       '/opt/local/share/proj',
       'c:/msys64/mingw64/share/proj',
       'c:/mingw64/share/proj',
       '/opt/local/lib/proj49/share/proj',
       '/opt/local/lib/proj5/share/proj',
       '/opt/local/lib/proj6/share/proj']
    end

    def data_path
      result = self.search_paths.detect do |path|
        File.directory?(path)
      end

      unless result
        raise(Error, "Could not find Proj data directory. Please set the PROJ_LIB environmental variable to correct directory")
      end

      result
    end

    def db_path
      self.search_paths.map do |path|
        File.join(path, 'proj.db')
      end.detect do |path|
        File.exists?(path)
      end

      unless result
        raise(Error, "Could not find Proj database (proj.db). Please set the PROJ_LIB environmental variable to directory that contains it")
      end

      result
    end<commit_msg>Need to return a result. Doh!<commit_after>require 'singleton'

module Proj
  class Config
    include Singleton

    def proj_lib
      ENV['PROJ_LIB'] || find_path
    end

    def search_paths
      ['/usr/share/proj',
       '/usr/local/share/proj',
       '/opt/share/proj',
       '/opt/local/share/proj',
       'c:/msys64/mingw64/share/proj',
       'c:/mingw64/share/proj',
       '/opt/local/lib/proj49/share/proj',
       '/opt/local/lib/proj5/share/proj',
       '/opt/local/lib/proj6/share/proj']
    end

    def data_path
      result = self.search_paths.detect do |path|
        File.directory?(path)
      end

      unless result
        raise(Error, "Could not find Proj data directory. Please set the PROJ_LIB environmental variable to correct directory")
      end

      result
    end

    def db_path
      result = self.search_paths.map do |path|
        File.join(path, 'proj.db')
      end.detect do |path|
        File.exists?(path)
      end

      unless result
        raise(Error, "Could not find Proj database (proj.db). Please set the PROJ_LIB environmental variable to directory that contains it")
      end

      result
    end
{'fraction_non_alphanumeric': 0.10725141120277898, 'fraction_numerical': 0.008684324793747287, 'mean_word_length': 2.1432469304229196, 'pattern_counts': {'":': 0, '<': 3, '<?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': '5164872', 'n_tokens_mistral': 767, 'n_tokens_neox': 712, 'n_words': 183}