Class: Capybara::Server::Middleware Private
Relationships & Source Files | |
Namespace Children | |
Classes:
| |
Inherits: | Object |
Defined in: | lib/capybara/server/middleware.rb |
Class Method Summary
- .new(app, server_errors, extra_middleware = []) ⇒ Middleware constructor Internal use only
Instance Attribute Summary
- #error readonly Internal use only
- #pending_requests readonly Internal use only
- #pending_requests? ⇒ Boolean readonly Internal use only
Instance Method Summary
- #call(env) Internal use only
- #clear_error Internal use only
Constructor Details
.new(app, server_errors, extra_middleware = []) ⇒ Middleware
Instance Attribute Details
#error (readonly)
[ GitHub ]# File 'lib/capybara/server/middleware.rb', line 29
attr_reader :error
#pending_requests (readonly)
[ GitHub ]# File 'lib/capybara/server/middleware.rb', line 40
def pending_requests @counter.value end
#pending_requests? ⇒ Boolean
(readonly)
# File 'lib/capybara/server/middleware.rb', line 44
def pending_requests? @counter.positive? end
Instance Method Details
#call(env)
[ GitHub ]# File 'lib/capybara/server/middleware.rb', line 52
def call(env) if env['PATH_INFO'] == '/__identify__' [200, {}, [@app.object_id.to_s]] else request_uri = env['REQUEST_URI'] @counter.increment(request_uri) begin @extended_app.call(env) rescue *@server_errors => e @error ||= e raise e ensure @counter.decrement(request_uri) end end end
#clear_error
[ GitHub ]# File 'lib/capybara/server/middleware.rb', line 48
def clear_error @error = nil end