Class: Rack::MiniProfiler::Config
- Inherits:
-
Object
- Object
- Rack::MiniProfiler::Config
- Defined in:
- lib/mini_profiler/config.rb
Instance Attribute Summary collapse
-
#assets_url ⇒ Object
Returns the value of attribute assets_url.
-
#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.
-
#content_security_policy_nonce ⇒ Object
Returns the value of attribute content_security_policy_nonce.
-
#cookie_path ⇒ Object
Returns the value of attribute cookie_path.
-
#disable_caching ⇒ Object
Returns the value of attribute disable_caching.
-
#enable_advanced_debugging_tools ⇒ Object
Returns the value of attribute enable_advanced_debugging_tools.
-
#enable_hotwire_turbo_drive_support ⇒ Object
Returns the value of attribute enable_hotwire_turbo_drive_support.
-
#enabled ⇒ Object
Returns the value of attribute enabled.
-
#flamegraph_ignore_gc ⇒ Object
Returns the value of attribute flamegraph_ignore_gc.
-
#flamegraph_mode ⇒ Object
Returns the value of attribute flamegraph_mode.
-
#flamegraph_sample_rate ⇒ Object
Returns the value of attribute flamegraph_sample_rate.
-
#html_container ⇒ Object
ui accessors.
-
#logger ⇒ Object
Returns the value of attribute logger.
-
#max_snapshot_groups ⇒ Object
snapshot related config.
-
#max_snapshots_per_group ⇒ Object
snapshot related config.
-
#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.
-
#profile_parameter ⇒ Object
Returns the value of attribute profile_parameter.
-
#show_children ⇒ Object
ui accessors.
-
#show_controls ⇒ Object
ui accessors.
-
#show_total_sql_count ⇒ 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.
-
#snapshot_every_n_requests ⇒ Object
snapshot related config.
-
#snapshot_hidden_custom_fields ⇒ Object
snapshot related config.
-
#snapshots_redact_sql_queries ⇒ Object
snapshot related config.
-
#snapshots_transport_auth_key ⇒ Object
snapshot related config.
-
#snapshots_transport_destination_url ⇒ Object
snapshot related config.
-
#snapshots_transport_gzip_requests ⇒ Object
snapshot related config.
-
#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.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#assets_url ⇒ Object
Returns the value of attribute assets_url.
96 97 98 |
# File 'lib/mini_profiler/config.rb', line 96 def assets_url @assets_url end |
#authorization_mode ⇒ Object
Returns the value of attribute authorization_mode.
72 73 74 |
# File 'lib/mini_profiler/config.rb', line 72 def @authorization_mode end |
#auto_inject ⇒ Object
Returns the value of attribute auto_inject.
72 73 74 |
# File 'lib/mini_profiler/config.rb', line 72 def auto_inject @auto_inject end |
#backtrace_ignores ⇒ Object
Returns the value of attribute backtrace_ignores.
72 73 74 |
# File 'lib/mini_profiler/config.rb', line 72 def backtrace_ignores @backtrace_ignores end |
#backtrace_includes ⇒ Object
Returns the value of attribute backtrace_includes.
72 73 74 |
# File 'lib/mini_profiler/config.rb', line 72 def backtrace_includes @backtrace_includes end |
#backtrace_remove ⇒ Object
Returns the value of attribute backtrace_remove.
72 73 74 |
# File 'lib/mini_profiler/config.rb', line 72 def backtrace_remove @backtrace_remove end |
#backtrace_threshold_ms ⇒ Object
Returns the value of attribute backtrace_threshold_ms.
72 73 74 |
# File 'lib/mini_profiler/config.rb', line 72 def backtrace_threshold_ms @backtrace_threshold_ms end |
#base_url_path ⇒ Object
Returns the value of attribute base_url_path.
72 73 74 |
# File 'lib/mini_profiler/config.rb', line 72 def base_url_path @base_url_path end |
#collapse_results ⇒ Object
ui accessors
83 84 85 |
# File 'lib/mini_profiler/config.rb', line 83 def collapse_results @collapse_results end |
#content_security_policy_nonce ⇒ Object
Returns the value of attribute content_security_policy_nonce.
72 73 74 |
# File 'lib/mini_profiler/config.rb', line 72 def content_security_policy_nonce @content_security_policy_nonce end |
#cookie_path ⇒ Object
Returns the value of attribute cookie_path.
72 73 74 |
# File 'lib/mini_profiler/config.rb', line 72 def @cookie_path end |
#disable_caching ⇒ Object
Returns the value of attribute disable_caching.
72 73 74 |
# File 'lib/mini_profiler/config.rb', line 72 def disable_caching @disable_caching end |
#enable_advanced_debugging_tools ⇒ Object
Returns the value of attribute enable_advanced_debugging_tools.
72 73 74 |
# File 'lib/mini_profiler/config.rb', line 72 def enable_advanced_debugging_tools @enable_advanced_debugging_tools end |
#enable_hotwire_turbo_drive_support ⇒ Object
Returns the value of attribute enable_hotwire_turbo_drive_support.
72 73 74 |
# File 'lib/mini_profiler/config.rb', line 72 def enable_hotwire_turbo_drive_support @enable_hotwire_turbo_drive_support end |
#enabled ⇒ Object
Returns the value of attribute enabled.
72 73 74 |
# File 'lib/mini_profiler/config.rb', line 72 def enabled @enabled end |
#flamegraph_ignore_gc ⇒ Object
Returns the value of attribute flamegraph_ignore_gc.
72 73 74 |
# File 'lib/mini_profiler/config.rb', line 72 def flamegraph_ignore_gc @flamegraph_ignore_gc end |
#flamegraph_mode ⇒ Object
Returns the value of attribute flamegraph_mode.
72 73 74 |
# File 'lib/mini_profiler/config.rb', line 72 def flamegraph_mode @flamegraph_mode end |
#flamegraph_sample_rate ⇒ Object
Returns the value of attribute flamegraph_sample_rate.
72 73 74 |
# File 'lib/mini_profiler/config.rb', line 72 def flamegraph_sample_rate @flamegraph_sample_rate end |
#html_container ⇒ Object
ui accessors
83 84 85 |
# File 'lib/mini_profiler/config.rb', line 83 def html_container @html_container end |
#logger ⇒ Object
Returns the value of attribute logger.
72 73 74 |
# File 'lib/mini_profiler/config.rb', line 72 def logger @logger end |
#max_snapshot_groups ⇒ Object
snapshot related config
88 89 90 |
# File 'lib/mini_profiler/config.rb', line 88 def max_snapshot_groups @max_snapshot_groups end |
#max_snapshots_per_group ⇒ Object
snapshot related config
88 89 90 |
# File 'lib/mini_profiler/config.rb', line 88 def max_snapshots_per_group @max_snapshots_per_group end |
#max_sql_param_length ⇒ Object
Returns the value of attribute max_sql_param_length.
72 73 74 |
# File 'lib/mini_profiler/config.rb', line 72 def max_sql_param_length @max_sql_param_length end |
#max_traces_to_show ⇒ Object
ui accessors
83 84 85 |
# File 'lib/mini_profiler/config.rb', line 83 def max_traces_to_show @max_traces_to_show end |
#position ⇒ Object
ui accessors
83 84 85 |
# File 'lib/mini_profiler/config.rb', line 83 def position @position end |
#pre_authorize_cb ⇒ Object
Returns the value of attribute pre_authorize_cb.
72 73 74 |
# File 'lib/mini_profiler/config.rb', line 72 def @pre_authorize_cb end |
#profile_parameter ⇒ Object
Returns the value of attribute profile_parameter.
72 73 74 |
# File 'lib/mini_profiler/config.rb', line 72 def profile_parameter @profile_parameter end |
#show_children ⇒ Object
ui accessors
83 84 85 |
# File 'lib/mini_profiler/config.rb', line 83 def show_children @show_children end |
#show_controls ⇒ Object
ui accessors
83 84 85 |
# File 'lib/mini_profiler/config.rb', line 83 def show_controls @show_controls end |
#show_total_sql_count ⇒ Object
ui accessors
83 84 85 |
# File 'lib/mini_profiler/config.rb', line 83 def show_total_sql_count @show_total_sql_count end |
#show_trivial ⇒ Object
ui accessors
83 84 85 |
# File 'lib/mini_profiler/config.rb', line 83 def show_trivial @show_trivial end |
#skip_paths ⇒ Object
Returns the value of attribute skip_paths.
72 73 74 |
# File 'lib/mini_profiler/config.rb', line 72 def skip_paths @skip_paths end |
#skip_schema_queries ⇒ Object
Returns the value of attribute skip_schema_queries.
72 73 74 |
# File 'lib/mini_profiler/config.rb', line 72 def skip_schema_queries @skip_schema_queries end |
#skip_sql_param_names ⇒ Object
Returns the value of attribute skip_sql_param_names.
72 73 74 |
# File 'lib/mini_profiler/config.rb', line 72 def skip_sql_param_names @skip_sql_param_names end |
#snapshot_every_n_requests ⇒ Object
snapshot related config
88 89 90 |
# File 'lib/mini_profiler/config.rb', line 88 def snapshot_every_n_requests @snapshot_every_n_requests end |
#snapshot_hidden_custom_fields ⇒ Object
snapshot related config
88 89 90 |
# File 'lib/mini_profiler/config.rb', line 88 def snapshot_hidden_custom_fields @snapshot_hidden_custom_fields end |
#snapshots_redact_sql_queries ⇒ Object
snapshot related config
88 89 90 |
# File 'lib/mini_profiler/config.rb', line 88 def snapshots_redact_sql_queries @snapshots_redact_sql_queries end |
#snapshots_transport_auth_key ⇒ Object
snapshot related config
88 89 90 |
# File 'lib/mini_profiler/config.rb', line 88 def snapshots_transport_auth_key @snapshots_transport_auth_key end |
#snapshots_transport_destination_url ⇒ Object
snapshot related config
88 89 90 |
# File 'lib/mini_profiler/config.rb', line 88 def snapshots_transport_destination_url @snapshots_transport_destination_url end |
#snapshots_transport_gzip_requests ⇒ Object
snapshot related config
88 89 90 |
# File 'lib/mini_profiler/config.rb', line 88 def snapshots_transport_gzip_requests @snapshots_transport_gzip_requests end |
#start_hidden ⇒ Object
ui accessors
83 84 85 |
# File 'lib/mini_profiler/config.rb', line 83 def start_hidden @start_hidden end |
#storage ⇒ Object
Returns the value of attribute storage.
72 73 74 |
# File 'lib/mini_profiler/config.rb', line 72 def storage @storage end |
#storage_failure ⇒ Object
Returns the value of attribute storage_failure.
72 73 74 |
# File 'lib/mini_profiler/config.rb', line 72 def storage_failure @storage_failure end |
#storage_instance ⇒ Object
Returns the value of attribute storage_instance.
72 73 74 |
# File 'lib/mini_profiler/config.rb', line 72 def storage_instance @storage_instance end |
#storage_options ⇒ Object
Returns the value of attribute storage_options.
72 73 74 |
# File 'lib/mini_profiler/config.rb', line 72 def @storage_options end |
#suppress_encoding ⇒ Object
Returns the value of attribute suppress_encoding.
72 73 74 |
# File 'lib/mini_profiler/config.rb', line 72 def suppress_encoding @suppress_encoding end |
#toggle_shortcut ⇒ Object
ui accessors
83 84 85 |
# File 'lib/mini_profiler/config.rb', line 83 def toggle_shortcut @toggle_shortcut end |
#use_existing_jquery ⇒ Object
Deprecated options
94 95 96 |
# File 'lib/mini_profiler/config.rb', line 94 def use_existing_jquery @use_existing_jquery end |
#user_provider ⇒ Object
Returns the value of attribute user_provider.
72 73 74 |
# File 'lib/mini_profiler/config.rb', line 72 def user_provider @user_provider end |
Class Method Details
.attr_accessor(*vars) ⇒ Object
6 7 8 9 10 |
# File 'lib/mini_profiler/config.rb', line 6 def self.attr_accessor(*vars) @attributes ||= [] @attributes.concat vars super(*vars) end |
.attributes ⇒ Object
12 13 14 |
# File 'lib/mini_profiler/config.rb', line 12 def self.attributes @attributes end |
.default ⇒ Object
16 17 18 19 20 21 22 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 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/mini_profiler/config.rb', line 16 def self.default new.instance_eval { @auto_inject = true # automatically inject on every html page @base_url_path = "/mini-profiler-resources/".dup @cookie_path = "/".dup @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 @flamegraph_mode = :wall @flamegraph_ignore_gc = false @storage_failure = Proc.new do |exception| if @logger @logger.warn("MiniProfiler storage failure: #{exception.}") end end @enabled = true @max_sql_param_length = 0 # disable sql parameter collection by default @skip_sql_param_names = /password/ # skips parameters with the name password by default @enable_advanced_debugging_tools = false @snapshot_every_n_requests = -1 @max_snapshot_groups = 50 @max_snapshots_per_group = 15 # ui parameters @autorized = true @collapse_results = true @max_traces_to_show = 20 @show_children = false @show_controls = false @show_trivial = false @show_total_sql_count = false @start_hidden = false @toggle_shortcut = 'alt+p' @html_container = 'body' @position = "top-left" @snapshot_hidden_custom_fields = [] @snapshots_transport_destination_url = nil @snapshots_transport_auth_key = nil @snapshots_redact_sql_queries = true @snapshots_transport_gzip_requests = false @enable_hotwire_turbo_drive_support = false @profile_parameter = "pp" self } end |
Instance Method Details
#horizontal_position ⇒ Object
127 128 129 |
# File 'lib/mini_profiler/config.rb', line 127 def horizontal_position position.include?('right') ? 'right' : 'left' end |
#merge!(config) ⇒ Object
131 132 133 134 135 136 137 138 139 140 141 142 |
# File 'lib/mini_profiler/config.rb', line 131 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 end |
#vertical_position ⇒ Object
123 124 125 |
# File 'lib/mini_profiler/config.rb', line 123 def vertical_position position.include?('bottom') ? 'bottom' : 'top' end |