<commit_before>require 'webrick'
require 'data'
require 'formatter/json'
require 'erb'

module Rubrowser
  class Server < WEBrick::HTTPServer
    include ERB::Util

    ROUTES = {
      '/' => :root,
      '/data.json' => :data
    }

    def self.start(options = {})
      new(options).start
    end

    def initialize(options)
      super Port: options[:port]
      @files = options[:files]

      mount_proc '/' do |req, res|
        res.body = router(req.path)
      end

      trap('INT') { shutdown }
    end

    private

    attr_reader :files<commit_msg>server won't interrupt the INT signal, easier to shutdown on hanging<commit_after>require 'webrick'
require 'data'
require 'formatter/json'
require 'erb'

module Rubrowser
  class Server < WEBrick::HTTPServer
    include ERB::Util

    ROUTES = {
      '/' => :root,
      '/data.json' => :data
    }

    def self.start(options = {})
      new(options).start
    end

    def initialize(options)
      super Port: options[:port]
      @files = options[:files]

      mount_proc '/' do |req, res|
        res.body = router(req.path)
      end
    end

    private

    attr_reader :files
{'fraction_non_alphanumeric': 0.12163336229365769, 'fraction_numerical': 0.0, 'mean_word_length': 2.4491017964071857, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, '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': '7097634', 'n_tokens_mistral': 378, 'n_tokens_neox': 362, 'n_words': 93}