Exception: Sidewalk::Redirect

Inherits:
HttpError
  • Object
show all
Defined in:
lib/sidewalk/redirect.rb

Overview

Base class for HTTP-level redirections.

This, and its’ subclasses are expected to be raised.

Direct Known Subclasses

PermanentRedirect, SeeOtherRedirect

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from HttpError

#description, #status

Constructor Details

#initialize(url, status, description) ⇒ Redirect

Initialize a Redirect.

You probably don’t want to use this directly - use PermanentRedirect or SeeOtherRedirect instead.

Parameters:

  • url (String, URI)

    is where to redirect to

  • status (Fixnum)

    is a numeric HTTP status code

  • description (String)

    is a short description of the status code, such as ‘Moved Permanently’



20
21
22
23
# File 'lib/sidewalk/redirect.rb', line 20

def initialize url, status, description
  @url = url.to_s
  super status, description
end

Instance Attribute Details

#urlObject (readonly)

Where to redirect to.



9
10
11
# File 'lib/sidewalk/redirect.rb', line 9

def url
  @url
end