<commit_before>module Nominatim
  class Reverse < Client
    attr_reader :criteria

    def initialize
      @criteria = {}
    end

    # Returns search result.
    def fetch
      Nominatim::Place.new(get(Nominatim.config.reverse_url, @criteria).body)
    end

    # Latitude string to search for.
    #
    # @param lat [String] Latitude
    # @return [Nominatim::Reverse]
    def lat(lat)
      @criteria[:lat] = lat
      self
    end

    # Longitude string to search for.
    #
    # @param lon [String] Longitude
    # @return [Nominatim::Reverse]
    def lon(lon)
      @criteria[:lon] = lon
      self<commit_msg>Return nil instead of Place object in case of no results<commit_after>module Nominatim
  class Reverse < Client
    attr_reader :criteria

    def initialize
      @criteria = {}
    end

    # Returns search result or nil if no results received.
    def fetch
      body = get(Nominatim.config.reverse_url, @criteria).body
      return nil if body.empty?
      Nominatim::Place.new(body)
    end

    # Latitude string to search for.
    #
    # @param lat [String] Latitude
    # @return [Nominatim::Reverse]
    def lat(lat)
      @criteria[:lat] = lat
      self
    end

    # Longitude string to search for.
    #
    # @param lon [String] Longitude
    # @return [Nominatim::Reverse]
    def lon(lon)
      @criteria[:lon] = lon
      self
{'fraction_non_alphanumeric': 0.09422936449963477, 'fraction_numerical': 0.0, 'mean_word_length': 2.4164588528678306, 'pattern_counts': {'":': 0, '<': 5, '<?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': '1171695', 'n_tokens_mistral': 453, 'n_tokens_neox': 438, 'n_words': 125}