<commit_before>require 'sinatra'

module Metropoli
  class Api < Sinatra::Base
    include ConfigurationHelper
  
    get '/cities.json' do
      @cities =  city_class.autocomplete(params[:q])
      @cities &= city_class.limit(autocomplete_limit)
      jsonify(@cities)
    end
  
    get '/states.json' do 
      @states = state_class.autocomplete(params[:q])
      @states &= state_class.limit(autocomplete_limit)
      jsonify(@states)
    end
  
    get '/countries.json' do
      @countries = country_class.autocomplete(params[:q])
      @countries &= country_class.limit(autocomplete_limit)
      jsonify(@countries)
    end
  
    private
  
    def jsonify(resource_array)
      "[#{resource_array.all.map(&:metropoli_json).join(',').to_s}]"
    end
  
  end
end<commit_msg>Fixed Rails 3.1 Deprecation Warning:<commit_after>require 'sinatra'

module Metropoli
  class Api < Sinatra::Base
    include ConfigurationHelper
  
    get '/cities.json' do
      @cities = city_class.autocomplete(params[:q])
      @cities = @cities.merge(city_class.limit(autocomplete_limit))
      jsonify(@cities)
    end
  
    get '/states.json' do 
      @states = state_class.autocomplete(params[:q])
      @states = @states.merge(state_class.limit(autocomplete_limit))
      jsonify(@states)
    end
  
    get '/countries.json' do
      @countries = country_class.autocomplete(params[:q])
      @countries = @countries.merge(country_class.limit(autocomplete_limit))
      jsonify(@countries)
    end
  
    private
  
    def jsonify(resource_array)
      "[#{resource_array.all.map(&:metropoli_json).join(',').to_s}]"
    end
  
  end
end
{'fraction_non_alphanumeric': 0.12078479460453709, 'fraction_numerical': 0.001226241569589209, 'mean_word_length': 3.2061855670103094, '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': '4086892', 'n_tokens_mistral': 555, 'n_tokens_neox': 541, 'n_words': 89}