Class: Rack::Lint
- Inherits:
-
Object
- Object
- Rack::Lint
- Defined in:
- lib/rack/lint.rb
Overview
Validates your application and the requests and responses according to the Rack spec. See SPEC.rdoc for details.
Defined Under Namespace
Constant Summary collapse
- ALLOWED_SCHEMES =
:stopdoc:
%w(https http wss ws).freeze
- REQUEST_PATH_ORIGIN_FORM =
/\A\/[^#]*\z/
- REQUEST_PATH_ABSOLUTE_FORM =
/\A#{Utils::URI_PARSER.make_regexp}\z/
- REQUEST_PATH_AUTHORITY_FORM =
/\A[^\/:]+:\d+\z/
- REQUEST_PATH_ASTERISK_FORM =
'*'
Instance Method Summary collapse
-
#call(env = nil) ⇒ Object
Invoke the application, validating the request and response according to the Rack spec.
-
#initialize(app) ⇒ Lint
constructor
N.B.
Constructor Details
#initialize(app) ⇒ Lint
N.B. The empty ‘##` comments creates paragraphs in the output. A trailing “" is used to escape the newline character, which combines the comments into a single paragraph.
Rack Specification
This specification aims to formalize the Rack protocol. You can (and should) use Rack::Lint
to enforce it. When you develop middleware, be sure to test with Rack::Lint
to catch possible violations of this specification.
The Application
A Rack application is a Ruby object that responds to call
. \
65 66 67 68 69 |
# File 'lib/rack/lint.rb', line 65 def initialize(app) raise LintError, "app must respond to call" unless app.respond_to?(:call) @app = app end |