Class: Rack::Validator

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

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ Validator

Returns a new instance of Validator.



6
7
8
# File 'lib/rack/validator.rb', line 6

def initialize(app)
  @app = app
end

Instance Method Details

#call(env) ⇒ Object



10
11
12
13
14
15
# File 'lib/rack/validator.rb', line 10

def call(env)
  status, headers, response = @app.call(env)

  @response = response.respond_to?(:body) ? Rack::TidyResponse.new(response.body).to_s : response
  [status, headers, @response]
end