Class: Errplane::Rack

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

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ Rack

Returns a new instance of Rack.



3
4
5
# File 'lib/errplane/rack.rb', line 3

def initialize(app)
  @app = app
end

Instance Method Details

#_call(env) ⇒ Object



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

def _call(env)
  begin
    status, headers, body = @app.call(env)
  rescue => e
    Errplane.transmit_unless_ignorable(e, env)
    raise(e)
  ensure
    _body = []
    body.each { |line| _body << line } unless body.nil?
    body.close if body.respond_to?(:close)
  end

  [status, headers, _body]
end

#call(env) ⇒ Object



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

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