<commit_before>require "best_boy/engine.rb"

module BestBoy
  mattr_accessor :base_controller, :before_filter, :custom_redirect, :orm,
    :precompile_assets, :skip_after_filter, :skip_before_filter, :test_mode

  @@base_controller    = "ApplicationController"
  @@before_filter      = nil
  @@custom_redirect    = nil
  @@orm                = :active_record
  @@precompile_assets  = false
  @@skip_after_filter  = nil
  @@skip_before_filter = nil
  @@test_mode          = false

  # Load configuration from initializer
  def self.setup
    yield self
  end

  def self.in_test_mode
    test_mode_before = self.test_mode
    self.test_mode = true
    yield if block_given?
    self.test_mode = test_mode_before
  end

  def self.in_real_mode
    test_mode_before = self.test_mode
    self.test_mode = false
    yield if block_given?
    self.test_mode = test_mode_before
  end

end<commit_msg>Extract duplication into private method<commit_after>require "best_boy/engine.rb"

module BestBoy
  mattr_accessor :base_controller, :before_filter, :custom_redirect, :orm,
    :precompile_assets, :skip_after_filter, :skip_before_filter, :test_mode

  @@base_controller    = "ApplicationController"
  @@before_filter      = nil
  @@custom_redirect    = nil
  @@orm                = :active_record
  @@precompile_assets  = false
  @@skip_after_filter  = nil
  @@skip_before_filter = nil
  @@test_mode          = false

  # Load configuration from initializer
  def self.setup
    yield self
  end

  def self.in_test_mode(&block)
    executute_with_test_mode_set_to(true, &block)
  end

  def self.in_real_mode(&block)
    executute_with_test_mode_set_to(false, &block)
  end

  private

  def self.executute_with_test_mode_set_to(test_mode, &block)
    test_mode_before = self.test_mode
    self.test_mode = test_mode
    block.call if block.present?
    self.test_mode = test_mode_before
  end

end
{'fraction_non_alphanumeric': 0.07822410147991543, 'fraction_numerical': 0.0, 'mean_word_length': 3.639705882352941, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '58023', 'n_tokens_mistral': 656, 'n_tokens_neox': 626, 'n_words': 129}