Class: Rack::MiniProfiler::Config
- Inherits:
-
Object
- Object
- Rack::MiniProfiler::Config
- Defined in:
- lib/mini_profiler/config.rb
Instance Attribute Summary collapse
-
#authorization_mode ⇒ Object
Returns the value of attribute authorization_mode.
-
#auto_inject ⇒ Object
Returns the value of attribute auto_inject.
-
#backtrace_ignores ⇒ Object
Returns the value of attribute backtrace_ignores.
-
#backtrace_includes ⇒ Object
Returns the value of attribute backtrace_includes.
-
#backtrace_remove ⇒ Object
Returns the value of attribute backtrace_remove.
-
#backtrace_threshold_ms ⇒ Object
Returns the value of attribute backtrace_threshold_ms.
-
#base_url_path ⇒ Object
Returns the value of attribute base_url_path.
-
#disable_caching ⇒ Object
Returns the value of attribute disable_caching.
-
#enabled ⇒ Object
Returns the value of attribute enabled.
-
#flamegraph_sample_rate ⇒ Object
Returns the value of attribute flamegraph_sample_rate.
-
#logger ⇒ Object
Returns the value of attribute logger.
-
#position ⇒ Object
Returns the value of attribute position.
-
#pre_authorize_cb ⇒ Object
Returns the value of attribute pre_authorize_cb.
-
#skip_paths ⇒ Object
Returns the value of attribute skip_paths.
-
#skip_schema_queries ⇒ Object
Returns the value of attribute skip_schema_queries.
-
#start_hidden ⇒ Object
Returns the value of attribute start_hidden.
-
#storage ⇒ Object
Returns the value of attribute storage.
-
#storage_failure ⇒ Object
Returns the value of attribute storage_failure.
-
#storage_instance ⇒ Object
Returns the value of attribute storage_instance.
-
#storage_options ⇒ Object
Returns the value of attribute storage_options.
-
#toggle_shortcut ⇒ Object
Returns the value of attribute toggle_shortcut.
-
#use_existing_jquery ⇒ Object
Deprecated options.
-
#user_provider ⇒ Object
Returns the value of attribute user_provider.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#authorization_mode ⇒ Object
Returns the value of attribute authorization_mode.
15 16 17 |
# File 'lib/mini_profiler/config.rb', line 15 def @authorization_mode end |
#auto_inject ⇒ Object
Returns the value of attribute auto_inject.
15 16 17 |
# File 'lib/mini_profiler/config.rb', line 15 def auto_inject @auto_inject end |
#backtrace_ignores ⇒ Object
Returns the value of attribute backtrace_ignores.
15 16 17 |
# File 'lib/mini_profiler/config.rb', line 15 def backtrace_ignores @backtrace_ignores end |
#backtrace_includes ⇒ Object
Returns the value of attribute backtrace_includes.
15 16 17 |
# File 'lib/mini_profiler/config.rb', line 15 def backtrace_includes @backtrace_includes end |
#backtrace_remove ⇒ Object
Returns the value of attribute backtrace_remove.
15 16 17 |
# File 'lib/mini_profiler/config.rb', line 15 def backtrace_remove @backtrace_remove end |
#backtrace_threshold_ms ⇒ Object
Returns the value of attribute backtrace_threshold_ms.
15 16 17 |
# File 'lib/mini_profiler/config.rb', line 15 def backtrace_threshold_ms @backtrace_threshold_ms end |
#base_url_path ⇒ Object
Returns the value of attribute base_url_path.
15 16 17 |
# File 'lib/mini_profiler/config.rb', line 15 def base_url_path @base_url_path end |
#disable_caching ⇒ Object
Returns the value of attribute disable_caching.
15 16 17 |
# File 'lib/mini_profiler/config.rb', line 15 def disable_caching @disable_caching end |
#enabled ⇒ Object
Returns the value of attribute enabled.
15 16 17 |
# File 'lib/mini_profiler/config.rb', line 15 def enabled @enabled end |
#flamegraph_sample_rate ⇒ Object
Returns the value of attribute flamegraph_sample_rate.
15 16 17 |
# File 'lib/mini_profiler/config.rb', line 15 def flamegraph_sample_rate @flamegraph_sample_rate end |
#logger ⇒ Object
Returns the value of attribute logger.
15 16 17 |
# File 'lib/mini_profiler/config.rb', line 15 def logger @logger end |
#position ⇒ Object
Returns the value of attribute position.
15 16 17 |
# File 'lib/mini_profiler/config.rb', line 15 def position @position end |
#pre_authorize_cb ⇒ Object
Returns the value of attribute pre_authorize_cb.
15 16 17 |
# File 'lib/mini_profiler/config.rb', line 15 def @pre_authorize_cb end |
#skip_paths ⇒ Object
Returns the value of attribute skip_paths.
15 16 17 |
# File 'lib/mini_profiler/config.rb', line 15 def skip_paths @skip_paths end |
#skip_schema_queries ⇒ Object
Returns the value of attribute skip_schema_queries.
15 16 17 |
# File 'lib/mini_profiler/config.rb', line 15 def skip_schema_queries @skip_schema_queries end |
#start_hidden ⇒ Object
Returns the value of attribute start_hidden.
15 16 17 |
# File 'lib/mini_profiler/config.rb', line 15 def start_hidden @start_hidden end |
#storage ⇒ Object
Returns the value of attribute storage.
15 16 17 |
# File 'lib/mini_profiler/config.rb', line 15 def storage @storage end |
#storage_failure ⇒ Object
Returns the value of attribute storage_failure.
15 16 17 |
# File 'lib/mini_profiler/config.rb', line 15 def storage_failure @storage_failure end |
#storage_instance ⇒ Object
Returns the value of attribute storage_instance.
15 16 17 |
# File 'lib/mini_profiler/config.rb', line 15 def storage_instance @storage_instance end |
#storage_options ⇒ Object
Returns the value of attribute storage_options.
15 16 17 |
# File 'lib/mini_profiler/config.rb', line 15 def @storage_options end |
#toggle_shortcut ⇒ Object
Returns the value of attribute toggle_shortcut.
15 16 17 |
# File 'lib/mini_profiler/config.rb', line 15 def toggle_shortcut @toggle_shortcut end |
#use_existing_jquery ⇒ Object
Deprecated options
21 22 23 |
# File 'lib/mini_profiler/config.rb', line 21 def use_existing_jquery @use_existing_jquery end |
#user_provider ⇒ Object
Returns the value of attribute user_provider.
15 16 17 |
# File 'lib/mini_profiler/config.rb', line 15 def user_provider @user_provider end |
Class Method Details
.attr_accessor(*vars) ⇒ Object
5 6 7 8 9 |
# File 'lib/mini_profiler/config.rb', line 5 def self.attr_accessor(*vars) @attributes ||= [] @attributes.concat vars super(*vars) end |
.attributes ⇒ Object
11 12 13 |
# File 'lib/mini_profiler/config.rb', line 11 def self.attributes @attributes end |
.default ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/mini_profiler/config.rb', line 23 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.}") end end @enabled = true self } end |
Instance Method Details
#merge!(config) ⇒ Object
51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/mini_profiler/config.rb', line 51 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 |