class Cuprum::Rails::Responses::Html::RedirectResponse

Encapsulates an HTML response that redirects to a given path.

Attributes

path[R]

@return [String] the path or url to redirect to.

status[R]

@return [Integer] the HTTP status of the response.

Public Class Methods

new(path, status: 302) click to toggle source

@param path [String] The path or url to redirect to. @param status [Integer] The HTTP status of the response.

# File lib/cuprum/rails/responses/html/redirect_response.rb, line 10
def initialize(path, status: 302)
  @path   = path
  @status = status
end

Public Instance Methods

call(renderer) click to toggle source

Calls the renderer's redirect_to method with the path and status.

@param renderer [#redirect_to] The context for executing the response,

such as a Rails controller.
# File lib/cuprum/rails/responses/html/redirect_response.rb, line 25
def call(renderer)
  renderer.redirect_to(path, status: status)
end