Sha256: 0e88985b82d6f05fb32845aeed7efabaeead74624ada7d0dbb32b82ef3a1c801

Contents?: true

Size: 986 Bytes

Versions: 9

Compression:

Stored size: 986 Bytes

Contents

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)
    execute_with_test_mode_set_to(true, &block)
  end

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

  private

  def self.execute_with_test_mode_set_to(test_mode, &block)
    Mutex.new.synchronize do
      test_mode_before = self.test_mode
      self.test_mode = test_mode
      block.call if block.present?
      self.test_mode = test_mode_before
    end
  end

end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
best_boy-2.2.3 lib/best_boy.rb
best_boy-2.2.2 lib/best_boy.rb
best_boy-2.2.1 lib/best_boy.rb
best_boy-2.2.0 lib/best_boy.rb
best_boy-2.1.4 lib/best_boy.rb
best_boy-2.1.3 lib/best_boy.rb
best_boy-2.1.2 lib/best_boy.rb
best_boy-2.1.1 lib/best_boy.rb
best_boy-2.1.0 lib/best_boy.rb