forked from brynary/rack-bug
/
bug.rb
43 lines (35 loc) · 1.39 KB
/
bug.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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
require "rack"
module Rack::Bug
autoload :Options, "rack/bug/options"
autoload :Panel, "rack/bug/panel"
autoload :PanelApp, "rack/bug/panel_app"
autoload :ParamsSignature, "rack/bug/params_signature"
autoload :Render, "rack/bug/render"
autoload :Toolbar, "rack/bug/toolbar"
# Panels
autoload :ActiveRecordPanel, "rack/bug/panels/active_record_panel"
autoload :CachePanel, "rack/bug/panels/cache_panel"
autoload :LogPanel, "rack/bug/panels/log_panel"
autoload :MemoryPanel, "rack/bug/panels/memory_panel"
autoload :RailsInfoPanel, "rack/bug/panels/rails_info_panel"
autoload :RedisPanel, "rack/bug/panels/redis_panel"
autoload :RequestVariablesPanel, "rack/bug/panels/request_variables_panel"
autoload :SQLPanel, "rack/bug/panels/sql_panel"
autoload :TemplatesPanel, "rack/bug/panels/templates_panel"
autoload :TimerPanel, "rack/bug/panels/timer_panel"
VERSION = "0.2.2"
class SecurityError < StandardError
end
def self.enable
Thread.current["rack-bug.enabled"] = true
end
def self.disable
Thread.current["rack-bug.enabled"] = false
end
def self.enabled?
Thread.current["rack-bug.enabled"] == true
end
def self.new(*args, &block)
Toolbar.new(*args, &block)
end
end