Class: Rampart::RedirectEvent

Inherits:
Object
  • Object
show all
Defined in:
lib/rampart/events/redirect_event.rb

Instance Method Summary collapse

Constructor Details

#initialize(url, status = 302) ⇒ RedirectEvent

Returns a new instance of RedirectEvent.



5
6
7
8
# File 'lib/rampart/events/redirect_event.rb', line 5

def initialize(url, status=302)
  @url = url
  @status = status
end

Instance Method Details

#halt?Boolean

Returns:

  • (Boolean)


10
11
12
# File 'lib/rampart/events/redirect_event.rb', line 10

def halt?
  true
end

#success?Boolean

Returns:

  • (Boolean)


14
15
16
# File 'lib/rampart/events/redirect_event.rb', line 14

def success?
  false
end

#to_trupleObject



18
19
20
21
22
23
# File 'lib/rampart/events/redirect_event.rb', line 18

def to_truple
  response = Response.new
  response.write("Redirecting to: #{@url}")
  response.redirect(@url, @status)
  response.finish
end