<commit_before>require 'r18n-core'
require 'pathname'
require_relative "rack-r18n/helpers"

module Rack
  class R18n
    # Avaible options:
    # :default => en
    # :dirs => "i18n"
    # Note: This is relative to #root
    attr_reader :options, :dirs
    def initialize(app, options = {})
      @app = app
      @options = options

      ::R18n::I18n.default = @options[:default] || "en"
      @options[:dirs] ||= "i18n"
      @dirs = Array(@options[:dirs]).map do |dir|
        (Pathname(root) + dir).expand_path
      end
    end

    def call(env)
      @env = env
      set_r18n
      @app.call(env)
    end

    def set_r18n<commit_msg>some code beauty<commit_after>require 'r18n-core'
require 'pathname'
require_relative "rack-r18n/helpers"

module Rack
  class R18n
    # Avaible options:
    # :default => en
    # :dirs => "i18n"
    # Note: This is relative to #root
    attr_reader :options, :dirs
    def initialize(app, options = {})
      @app = app
      @options = options

      ::R18n::I18n.default = @options[:default] || "en"
      @options[:dirs] ||= "i18n"
      @dirs = Array(@options[:dirs]).map do |dir|
        (Pathname(root) + dir).expand_path
      end
    end

    def call(env)
      @env = env
      set_r18n
      @app.call(@env)
    end

    def set_r18n
{'fraction_non_alphanumeric': 0.1372093023255814, 'fraction_numerical': 0.027906976744186046, 'mean_word_length': 2.4797843665768196, 'pattern_counts': {'":': 0, '<': 3, '<?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': '2707887', 'n_tokens_mistral': 493, 'n_tokens_neox': 470, 'n_words': 109}