Class: Redirector::Middleware::Responder

Inherits:
Object
  • Object
show all
Defined in:
lib/redirector/middleware.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(application, environment) ⇒ Responder

Returns a new instance of Responder.



16
17
18
19
# File 'lib/redirector/middleware.rb', line 16

def initialize(application, environment)
  @app = application
  @env = environment
end

Instance Attribute Details

#appObject (readonly)

Returns the value of attribute app.



14
15
16
# File 'lib/redirector/middleware.rb', line 14

def app
  @app
end

#envObject (readonly)

Returns the value of attribute env.



14
15
16
# File 'lib/redirector/middleware.rb', line 14

def env
  @env
end

Instance Method Details

#responseObject



21
22
23
24
25
26
27
# File 'lib/redirector/middleware.rb', line 21

def response
  if redirect?
    redirect_response
  else
    app.call(env)
  end
end