<commit_before># coding=utf-8

Rango.import("rack/handler")

class Rango::Dispatcher < Rango::Handler
  # @since 0.0.2
  def call(env)
    request  = Rango::Request.new(env)
    route    = Project.router.find(request.path)
    @body    = route.call(request)
    response = super(env)
    return [self.status, headers, self.body]
  rescue Rango::HttpExceptions::Error404 => exception
    return [exception.status, exception.headers, exception.body]
  # Let other error except 404 handle rack
  # rescue Rango::HttpExceptions::HttpError => exception
  #   return [exception.status, exception.headers, exception.body]
  # rescue Exception => exception
  #   Project.logger.exception(exception)
  #   @body = ["<h1>#{exception.message}</h1>"]
  #   exception.backtrace.each do |trace|
  #     @body.push("<li>#{trace}</li>")
  #   end
  #   return ["500", headers, self.body]
  end
end<commit_msg>Updated dispatcher to works with new router<commit_after># coding=utf-8

class Rango::Dispatcher
  attr_reader :request

  # @since 0.0.2
  def call(env)
    request = Rango::Request.new(env)
    route = Project.router.find(request.path)
    return route.call(request)
  rescue Rango::HttpExceptions::Error404 => exception
    return [exception.status, exception.headers, exception.body]
  # Let other error except 404 handle rack
  # rescue Rango::HttpExceptions::HttpError => exception
  #   return [exception.status, exception.headers, exception.body]
  # rescue Exception => exception
  #   Project.logger.exception(exception)
  #   @body = ["<h1>#{exception.message}</h1>"]
  #   exception.backtrace.each do |trace|
  #     @body.push("<li>#{trace}</li>")
  #   end
  #   return ["500", headers, self.body]
  end
end
{'fraction_non_alphanumeric': 0.14177362893815637, 'fraction_numerical': 0.01750291715285881, 'mean_word_length': 3.9423631123919307, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 17, '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': '1049408', 'n_tokens_mistral': 560, 'n_tokens_neox': 547, 'n_words': 119}