Class: Rack::Putty::Middleware

Inherits:
Object
  • Object
show all
Defined in:
lib/rack-putty/middleware.rb

Instance Method Summary collapse

Constructor Details

#initialize(app, options = {}) ⇒ Middleware

Returns a new instance of Middleware.



5
6
7
# File 'lib/rack-putty/middleware.rb', line 5

def initialize(app, options = {})
  @app, @options = app, options
end

Instance Method Details

#call(env) ⇒ Object



9
10
11
12
13
14
# File 'lib/rack-putty/middleware.rb', line 9

def call(env)
  response = action(env)

  # Allow middleware to cause stack to end early
  response.kind_of?(Hash) ? @app.call(env) : response
end