class Rack::MiniProfiler::Config

Attributes

authorization_mode[RW]
auto_inject[RW]
backtrace_ignores[RW]
backtrace_includes[RW]
backtrace_remove[RW]
backtrace_threshold_ms[RW]
base_url_path[RW]
collapse_results[RW]
disable_caching[RW]
disable_env_dump[RW]
enabled[RW]
flamegraph_sample_rate[RW]
logger[RW]
position[RW]
pre_authorize_cb[RW]
skip_paths[RW]
skip_schema_queries[RW]
start_hidden[RW]
storage[RW]
storage_failure[RW]
storage_instance[RW]
storage_options[RW]
toggle_shortcut[RW]
use_existing_jquery[RW]

Deprecated options

user_provider[RW]

Public Class Methods

attr_accessor(*vars) click to toggle source
Calls superclass method
# File lib/mini_profiler/config.rb, line 5
def self.attr_accessor(*vars)
  @attributes ||= []
  @attributes.concat vars
  super(*vars)
end
attributes() click to toggle source
# File lib/mini_profiler/config.rb, line 11
def self.attributes
  @attributes
end
default() click to toggle source
# File lib/mini_profiler/config.rb, line 26
def self.default
  new.instance_eval {
    @auto_inject      = true # automatically inject on every html page
    @base_url_path    = "/mini-profiler-resources/"
    @disable_caching  = true
    # called prior to rack chain, to ensure we are allowed to profile
    @pre_authorize_cb = lambda {|env| true}

    # called after rack chain, to ensure we are REALLY allowed to profile
    @position               = 'left'  # Where it is displayed
    @skip_schema_queries    = false
    @storage                = MiniProfiler::MemoryStore
    @user_provider          = Proc.new{|env| Rack::Request.new(env).ip}
    @authorization_mode     = :allow_all
    @toggle_shortcut        = 'Alt+P'
    @start_hidden           = false
    @backtrace_threshold_ms = 0
    @flamegraph_sample_rate = 0.5
    @storage_failure = Proc.new do |exception|
      if @logger
        @logger.warn("MiniProfiler storage failure: #{exception.message}")
      end
    end
    @enabled = true
    @disable_env_dump = false
    @collapse_results = true
    self
  }
end

Public Instance Methods

merge!(config) click to toggle source
# File lib/mini_profiler/config.rb, line 56
def merge!(config)
  return unless config
  if Hash === config
    config.each{|k,v| instance_variable_set "@#{k}",v}
  else
    self.class.attributes.each{ |k|
      v = config.send k
      instance_variable_set "@#{k}", v if v
    }
  end
end