Class: Rampart::FailEvent

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

Instance Method Summary collapse

Constructor Details

#initialize(message = "Not Authorized") ⇒ FailEvent

Returns a new instance of FailEvent.



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

def initialize(message="Not Authorized")
  @message = message
end

Instance Method Details

#halt?Boolean

Returns:

  • (Boolean)


9
10
11
# File 'lib/rampart/events/fail_event.rb', line 9

def halt?
  true
end

#success?Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/rampart/events/fail_event.rb', line 13

def success?
  false
end

#to_trupleObject



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

def to_truple
  response = Response.new
  response.write(@message)
  response.status = 401
  response.finish
end