Class: Orange::Middleware::Debugger

Inherits:
Base
  • Object
show all
Defined in:
lib/orange-more/debugger/middleware/debugger.rb

Instance Method Summary collapse

Instance Method Details

#init(opts = {}) ⇒ Object



5
6
7
8
# File 'lib/orange-more/debugger/middleware/debugger.rb', line 5

def init(opts = {})
  orange.add_pulp Orange::Pulp::DebuggerHelpers if orange.options[:development_mode]
  orange.mixin Orange::Mixins::DebuggerMixin if orange.options[:development_mode]
end

#packet_call(packet) ⇒ Object

Passes packet then parses the return



11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/orange-more/debugger/middleware/debugger.rb', line 11

def packet_call(packet)
  if orange.options[:development_mode]
    packet.flash['redirect_to'] = packet.request.path
    packet.add_css('debug_bar.css', :module => '_debugger_')
  end
  pass packet
  if orange.options[:development_mode]
    bar = orange[:parser].haml('debug_bar.haml', packet)
    packet[:content] = packet[:content].gsub('</body>', bar + '</body>')
  end
  packet.finish
end