<commit_before>module Tanuki
  class Configurator
    def self.set(option, value)
      Application.set(option, value)
    end

    def self.use(middleware, *args, &block)
      Application.use(middleware, *args, &block)
    end

    def self.visitor(sym, &block)
      Application.visitor(sym, &block)
    end
  end

  def self.development_application(&block)
    Application.instance_eval do
      use Rack::CommonLogger
      use Rack::Lint
      use Rack::ShowExceptions
    end
    common_application(&block)
  end

  def self.production_application(&block)
    common_application(&block)
  end

  private

  def self.common_application(&block)
    Application.instance_eval do
      use Rack::Head
      use Rack::ShowStatus
      set :server, [:thin, :mongrel, :webrick]
      set :host, '0.0.0.0'
      set :port, 3000
      set :root, File.dirname($0)
      set :app_root, proc { File.join(root, 'app') }
      set :cache_root, proc { File.join(root, 'cache') }
      set :root_page, User_Page_Index
      set :i18n, false
      set :language, nil
      set :language_fallback, {}
      set :languages, proc { language_fallback.keys }
      set :best_language, proc {|lngs| language_fallback[language].each {|lng| return lng if lngs.include? lng }; nil }
      visitor :string do s = ''; proc {|out| s << out.to_s } end
      visitor :array do arr = []; proc {|out| arr << out.to_s } end
    end
    Application.instance_eval { @context = @context.child }
    Configurator.instance_eval(&block) if block_given?
    Application.run
  end
end<commit_msg>Ruby 1.9.2 compatible scope resolution<commit_after>module Tanuki
  class Configurator
    def self.set(option, value)
      Application.set(option, value)
    end

    def self.use(middleware, *args, &block)
      Application.use(middleware, *args, &block)
    end

    def self.visitor(sym, &block)
      Application.visitor(sym, &block)
    end
  end

  def self.development_application(&block)
    Application.instance_eval do
      use Rack::CommonLogger
      use Rack::Lint
      use Rack::ShowExceptions
    end
    common_application(&block)
  end

  def self.production_application(&block)
    common_application(&block)
  end

  private

  def self.common_application(&block)
    Application.instance_eval do
      use Rack::Head
      use Rack::ShowStatus
      set :server, [:thin, :mongrel, :webrick]
      set :host, '0.0.0.0'
      set :port, 3000
      set :root, File.dirname($0)
      set :app_root, proc { File.join(root, 'app') }
      set :cache_root, proc { File.join(root, 'cache') }
      set :root_page, ::User_Page_Index
      set :i18n, false
      set :language, nil
      set :language_fallback, {}
      set :languages, proc { language_fallback.keys }
      set :best_language, proc {|lngs| language_fallback[language].each {|lng| return lng if lngs.include? lng }; nil }
      visitor :string do s = ''; proc {|out| s << out.to_s } end
      visitor :array do arr = []; proc {|out| arr << out.to_s } end
    end
    Application.instance_eval { @context = @context.child }
    Configurator.instance_eval(&block) if block_given?
    Application.run
  end
end
{'fraction_non_alphanumeric': 0.11368688472530962, 'fraction_numerical': 0.007939028262940616, 'mean_word_length': 2.9923954372623576, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, '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': '3713303', 'n_tokens_mistral': 1053, 'n_tokens_neox': 1023, 'n_words': 263}