<commit_before>require File.dirname(__FILE__)+'/analytical/rails/engine'
require File.dirname(__FILE__)+'/analytical/modules/base'
Dir.glob(File.dirname(__FILE__)+'/analytical/**/*.rb').each do |f|
  require f
end

module Analytical

  def analytical(options={})
    self.analytical_options = options

    config_options = { :modules => [] }
    File.open("#{::Rails.root}/config/analytical.yml") do |f|
      file_options = YAML::load(ERB.new(f.read).result).symbolize_keys
      env = (::Rails.env || :production).to_sym
      file_options = file_options[env] if file_options.has_key?(env)
      file_options.each do |k, v|
        config_options[k.to_sym] = v.symbolize_keys
        config_options[:modules] << k.to_sym unless options && options[:modules]
      end if file_options
    end if File.exists?("#{::Rails.root}/config/analytical.yml")

    self.analytical_options = self.analytical_options.reverse_merge config_options
  end

  module InstanceMethods
    def analytical
      @analytical ||= begin
        options = self.class.analytical_options.merge({
          :ssl => request.ssl?,
          :controller => self,
        })
        if options[:disable_if] && options[:disable_if].call(self)
          options[:modules] = []
        end
        options[:session] = session if options[:use_session_store]
        if analytical_is_robot?(request.user_agent)
          options[:modules] = []
        end
        options[:modules] = options[:module_filter].call(self, options[:modules]) if options[:module_filter]
        options[:javascript_helpers] ||= true
        Analytical::Api.new options
      end
    end
  end

  module HelperMethods
    def analytical
      controller.analytical
    end
  end
<commit_msg>Oops, forgot to rename this parameter<commit_after>require File.dirname(__FILE__)+'/analytical/rails/engine'
require File.dirname(__FILE__)+'/analytical/modules/base'
Dir.glob(File.dirname(__FILE__)+'/analytical/**/*.rb').each do |f|
  require f
end

module Analytical

  def analytical(options={})
    self.analytical_options = options

    config_options = { :modules => [] }
    File.open("#{::Rails.root}/config/analytical.yml") do |f|
      file_options = YAML::load(ERB.new(f.read).result).symbolize_keys
      env = (::Rails.env || :production).to_sym
      file_options = file_options[env] if file_options.has_key?(env)
      file_options.each do |k, v|
        config_options[k.to_sym] = v.symbolize_keys
        config_options[:modules] << k.to_sym unless options && options[:modules]
      end if file_options
    end if File.exists?("#{::Rails.root}/config/analytical.yml")

    self.analytical_options = self.analytical_options.reverse_merge config_options
  end

  module InstanceMethods
    def analytical
      @analytical ||= begin
        options = self.class.analytical_options.merge({
          :ssl => request.ssl?,
          :controller => self,
        })
        if options[:disable_if] && options[:disable_if].call(self)
          options[:modules] = []
        end
        options[:session] = session if options[:use_session_store]
        if analytical_is_robot?(request.user_agent)
          options[:modules] = []
        end
        options[:modules] = options[:filter_modules].call(self, options[:modules]) if options[:filter_modules]
        options[:javascript_helpers] ||= true
        Analytical::Api.new options
      end
    end
  end

  module HelperMethods
    def analytical
      controller.analytical
    end
  end

{'fraction_non_alphanumeric': 0.12700688073394495, 'fraction_numerical': 0.0, 'mean_word_length': 3.213768115942029, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, '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': '5677390', 'n_tokens_mistral': 1089, 'n_tokens_neox': 1037, 'n_words': 195}