123456789_123456789_123456789_123456789_123456789_

Class: Rack::Lint

Relationships & Source Files
Namespace Children
Classes:
Exceptions:
Inherits: Object
Defined in: lib/rack/lint.rb

Overview

Lint validates your application and the requests and responses according to the ::Rack spec.

Constant Summary

Class Method Summary

  • .new(app) ⇒ Lint constructor Internal use only

    AUTHORS: n.b. The trailing whitespace between paragraphs is important and should not be removed.

Instance Method Summary

Constructor Details

.new(app) ⇒ Lint

This method is for internal use only.

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 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.

Raises:

[ GitHub ]

  
# File 'lib/rack/lint.rb', line 38

def initialize(app)
  raise LintError, "app must respond to call" unless app.respond_to?(:call)

  @app = app
end

Instance Method Details

#call(env = nil)

This method is for internal use only.
[ GitHub ]

  
# File 'lib/rack/lint.rb', line 44

def call(env = nil)
  Wrapper.new(@app, env).response
end