Class: Rack::Lint
- Inherits:
-
Object
- Object
- Rack::Lint
- Defined in:
- lib/rack/lint.rb
Overview
Rack::Lint validates your application and the requests and responses according to the Rack spec.
Defined Under Namespace
Constant Summary collapse
- REQUEST_PATH_ORIGIN_FORM =
/\A\/[^#]*\z/
- REQUEST_PATH_ABSOLUTE_FORM =
/\A#{URI::DEFAULT_PARSER.make_regexp}\z/
- REQUEST_PATH_AUTHORITY_FORM =
/\A[^\/:]+:\d+\z/
- REQUEST_PATH_ASTERISK_FORM =
'*'
Instance Method Summary collapse
-
#call(env = nil) ⇒ Object
AUTHORS: n.b.
-
#initialize(app) ⇒ Lint
constructor
A new instance of Lint.
Constructor Details
#initialize(app) ⇒ Lint
Returns a new instance of Lint.
19 20 21 |
# File 'lib/rack/lint.rb', line 19 def initialize(app) @app = app end |
Instance Method Details
#call(env = nil) ⇒ Object
AUTHORS: n.b. The trailing whitespace between paragraphs is important and should not be removed. The whitespace creates paragraphs in the RDoc output.
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 add a Lint before and after to catch all mistakes.
Rack applications
A Rack application is a Ruby object (not a class) that responds to call
.
40 41 42 |
# File 'lib/rack/lint.rb', line 40 def call(env = nil) Wrapper.new(@app, env).response end |