Class: Rack::Insight::App
- Inherits:
-
Object
- Object
- Rack::Insight::App
- Defined in:
- lib/rack/insight/app.rb
Defined Under Namespace
Classes: SecurityError
Constant Summary collapse
- INSIGHT_ROOT =
"/__insight__"
- INSIGHT_REGEX =
%r{^#{INSIGHT_ROOT}}
Instance Attribute Summary collapse
-
#panels ⇒ Object
Returns the value of attribute panels.
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#config ⇒ Object
allow access to configuration settings directly through the app object!.
-
#initialize(app, options = {}, &block) ⇒ App
constructor
A new instance of App.
- #reset(new_options = nil) ⇒ Object
Methods included from Logging
Methods included from Options
Constructor Details
#initialize(app, options = {}, &block) ⇒ App
Returns a new instance of App.
36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/rack/insight/app.rb', line 36 def initialize(app, = {}, &block) @base_app = app @panels = [] instance_eval(&block) if block_given? build_normal_stack build_debug_stack # TODO: Understand when this would be used if [:on_initialize] [:on_initialize].call(self) end end |
Instance Attribute Details
#panels ⇒ Object
Returns the value of attribute panels.
48 49 50 |
# File 'lib/rack/insight/app.rb', line 48 def panels @panels end |
Instance Method Details
#call(env) ⇒ Object
55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/rack/insight/app.rb', line 55 def call(env) @original_request = Rack::Request.new(env) @env = env self. = @default_options if insight_active? Rack::Insight.enable env["rack-insight.panels"] = [] @debug_stack.call(env) else @normal_stack.call(env) end end |
#config ⇒ Object
allow access to configuration settings directly through the app object!
51 52 53 |
# File 'lib/rack/insight/app.rb', line 51 def config Rack::Insight::Config.config end |
#reset(new_options = nil) ⇒ Object
68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/rack/insight/app.rb', line 68 def reset(=nil) @env = nil () Rack::Insight::Instrumentation::ClassProbe::all_probes.each do |probe| probe.clear_collectors end Rack::Insight::Instrumentation::InstanceProbe::all_probes.each do |probe| probe.clear_collectors end Rack::Insight::Instrumentation::PackageDefinition.clear_collectors build_debug_stack end |