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.
-
#collapse_results ⇒ Object
ui accessors.
-
#disable_caching ⇒ Object
Returns the value of attribute disable_caching.
-
#disable_env_dump ⇒ Object
Returns the value of attribute disable_env_dump.
-
#enabled ⇒ Object
Returns the value of attribute enabled.
-
#flamegraph_sample_rate ⇒ Object
Returns the value of attribute flamegraph_sample_rate.
-
#horizontal_position ⇒ Object
ui accessors.
-
#html_container ⇒ Object
ui accessors.
-
#logger ⇒ Object
Returns the value of attribute logger.
-
#max_sql_param_length ⇒ Object
Returns the value of attribute max_sql_param_length.
-
#max_traces_to_show ⇒ Object
ui accessors.
-
#position ⇒ Object
ui accessors.
-
#pre_authorize_cb ⇒ Object
Returns the value of attribute pre_authorize_cb.
-
#show_children ⇒ Object
ui accessors.
-
#show_controls ⇒ Object
ui accessors.
-
#show_trivial ⇒ Object
ui accessors.
-
#skip_paths ⇒ Object
Returns the value of attribute skip_paths.
-
#skip_schema_queries ⇒ Object
Returns the value of attribute skip_schema_queries.
-
#skip_sql_param_names ⇒ Object
Returns the value of attribute skip_sql_param_names.
-
#start_hidden ⇒ Object
ui accessors.
-
#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.
-
#suppress_encoding ⇒ Object
Returns the value of attribute suppress_encoding.
-
#toggle_shortcut ⇒ Object
ui accessors.
-
#use_existing_jquery ⇒ Object
Deprecated options.
-
#user_provider ⇒ Object
Returns the value of attribute user_provider.
-
#vertical_position ⇒ Object
ui accessors.
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 |
#collapse_results ⇒ Object
ui accessors
24 25 26 |
# File 'lib/mini_profiler/config.rb', line 24 def collapse_results @collapse_results 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 |
#disable_env_dump ⇒ Object
Returns the value of attribute disable_env_dump.
15 16 17 |
# File 'lib/mini_profiler/config.rb', line 15 def disable_env_dump @disable_env_dump 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 |
#horizontal_position ⇒ Object
ui accessors
24 25 26 |
# File 'lib/mini_profiler/config.rb', line 24 def horizontal_position @horizontal_position end |
#html_container ⇒ Object
ui accessors
24 25 26 |
# File 'lib/mini_profiler/config.rb', line 24 def html_container @html_container end |
#logger ⇒ Object
Returns the value of attribute logger.
15 16 17 |
# File 'lib/mini_profiler/config.rb', line 15 def logger @logger end |
#max_sql_param_length ⇒ Object
Returns the value of attribute max_sql_param_length.
21 22 23 |
# File 'lib/mini_profiler/config.rb', line 21 def max_sql_param_length @max_sql_param_length end |
#max_traces_to_show ⇒ Object
ui accessors
24 25 26 |
# File 'lib/mini_profiler/config.rb', line 24 def max_traces_to_show @max_traces_to_show end |
#position ⇒ Object
ui accessors
24 25 26 |
# File 'lib/mini_profiler/config.rb', line 24 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 |
#show_children ⇒ Object
ui accessors
24 25 26 |
# File 'lib/mini_profiler/config.rb', line 24 def show_children @show_children end |
#show_controls ⇒ Object
ui accessors
24 25 26 |
# File 'lib/mini_profiler/config.rb', line 24 def show_controls @show_controls end |
#show_trivial ⇒ Object
ui accessors
24 25 26 |
# File 'lib/mini_profiler/config.rb', line 24 def show_trivial @show_trivial 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 |
#skip_sql_param_names ⇒ Object
Returns the value of attribute skip_sql_param_names.
21 22 23 |
# File 'lib/mini_profiler/config.rb', line 21 def skip_sql_param_names @skip_sql_param_names end |
#start_hidden ⇒ Object
ui accessors
24 25 26 |
# File 'lib/mini_profiler/config.rb', line 24 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 |
#suppress_encoding ⇒ Object
Returns the value of attribute suppress_encoding.
21 22 23 |
# File 'lib/mini_profiler/config.rb', line 21 def suppress_encoding @suppress_encoding end |
#toggle_shortcut ⇒ Object
ui accessors
24 25 26 |
# File 'lib/mini_profiler/config.rb', line 24 def toggle_shortcut @toggle_shortcut end |
#use_existing_jquery ⇒ Object
Deprecated options
29 30 31 |
# File 'lib/mini_profiler/config.rb', line 29 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 |
#vertical_position ⇒ Object
ui accessors
24 25 26 |
# File 'lib/mini_profiler/config.rb', line 24 def vertical_position @vertical_position 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
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/mini_profiler/config.rb', line 31 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 @skip_schema_queries = false @storage = MiniProfiler::MemoryStore @user_provider = Proc.new{|env| Rack::Request.new(env).ip} @authorization_mode = :allow_all @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 @disable_env_dump = false @max_sql_param_length = 0 # disable sql parameter collection by default @skip_sql_param_names = /password/ # skips parameters with the name password by default # ui parameters @autorized = true @collapse_results = true @max_traces_to_show = 20 @show_children = false @show_controls = false @show_trivial = false @start_hidden = false @toggle_shortcut = 'Alt+P' @html_container = 'body' self } end |
Instance Method Details
#merge!(config) ⇒ Object
71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/mini_profiler/config.rb', line 71 def merge!(config) if 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 set_positions! end |
#set_positions! ⇒ Object
85 86 87 88 89 |
# File 'lib/mini_profiler/config.rb', line 85 def set_positions! position = (self.position && self.position.match("-")) ? self.position.split("-") : ["top", "left"] self.vertical_position = position.first self.horizontal_position = position.last end |