Class: Rack::Lilypad

Inherits:
Object
  • Object
show all
Defined in:
lib/rack/lilypad.rb

Instance Method Summary collapse

Constructor Details

#initialize(app, api_key = nil, &block) ⇒ Lilypad

Returns a new instance of Lilypad.



6
7
8
9
# File 'lib/rack/lilypad.rb', line 6

def initialize(app, api_key=nil, &block)
  @app = app
  ::Lilypad.config api_key, &block
end

Instance Method Details

#call(env) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/rack/lilypad.rb', line 11

def call(env)
  status, headers, body =
    begin
      @app.call env
    rescue Exception => e
      ::Lilypad.notify e, env
      raise
    end
  
  if env['rack.exception']
    ::Lilypad.notify env['rack.exception'], env
  end
  
  [ status, headers, body ]
end