<commit_before>module Galago
  class Router

    REQUEST_METHODS = [
      "GET",
      "PATCH",
      "POST",
      "PUT",
      "DELETE"
    ]

    attr_reader :routes

    def initialize
      @routes = REQUEST_METHODS.each_with_object({}) do |request_method, routes|
        routes[request_method] = []
        routes
      end
    end

    def add_route(request_method, path, application)
      route = Route.new(request_method, path, application)
      routes[route.request_method] << route
    end

    def has_route?(request_method, path)
      find_route(request_method, path)
    end

    def process_request(env)
      if route = find_route(env['REQUEST_METHOD'], env['PATH_INFO'])
        route.call(env)
      else
        Rack::Response.new("Not Found", 404)
      end<commit_msg>Router#has_route? returns true or false<commit_after>module Galago
  class Router

    REQUEST_METHODS = [
      "GET",
      "PATCH",
      "POST",
      "PUT",
      "DELETE"
    ]

    attr_reader :routes

    def initialize
      @routes = REQUEST_METHODS.each_with_object({}) do |request_method, routes|
        routes[request_method] = []
        routes
      end
    end

    def add_route(request_method, path, application)
      route = Route.new(request_method, path, application)
      routes[route.request_method] << route
    end

    def has_route?(request_method, path)
      find_route(request_method, path) ? true : false
    end

    def process_request(env)
      if route = find_route(env['REQUEST_METHOD'], env['PATH_INFO'])
        route.call(env)
      else
        Rack::Response.new("Not Found", 404)
      end
{'fraction_non_alphanumeric': 0.1043585021485574, 'fraction_numerical': 0.003683241252302026, 'mean_word_length': 2.5824175824175826, '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': '3996573', 'n_tokens_mistral': 520, 'n_tokens_neox': 507, 'n_words': 109}