Class: WebTools::Middleware::Debugger

Inherits:
Object
  • Object
show all
Defined in:
lib/web_tools/middleware/debugger.rb

Defined Under Namespace

Classes: InProcessDebugger

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(app, *args) ⇒ Debugger

Returns a new instance of Debugger.



8
9
10
11
12
13
# File 'lib/web_tools/middleware/debugger.rb', line 8

def initialize(app, *args)
  @app = app
  self.production_mode = true if args.include?(:production)
  self.production_mode ||= false if args.include?(:development)
  self.production_mode ||= (ENV["RACK_ENV"] == :production)
end

Instance Attribute Details

#production_modeObject

Returns the value of attribute production_mode.



6
7
8
# File 'lib/web_tools/middleware/debugger.rb', line 6

def production_mode
  @production_mode
end

Instance Method Details

#_call(env) ⇒ Object



28
29
30
31
32
# File 'lib/web_tools/middleware/debugger.rb', line 28

def _call(env)
  @debugger.wrap_call(env) do
    Maglev::Debugger.debug(production_mode) { @app.call(env) }
  end
end

#call(env) ⇒ Object



24
25
26
# File 'lib/web_tools/middleware/debugger.rb', line 24

def call(env)
  dup._call(env)
end

#wrap_call(env) ⇒ Object



34
35
36
# File 'lib/web_tools/middleware/debugger.rb', line 34

def wrap_call(env)
  yield
end