Exception: C2::AccessDenied

Inherits:
StandardError
  • Object
show all
Defined in:
lib/c2/exceptions.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message = nil, subject = nil) ⇒ AccessDenied

Returns a new instance of AccessDenied.



6
7
8
9
10
# File 'lib/c2/exceptions.rb', line 6

def initialize(message = nil, subject = nil)
  @message = message
  @subject = subject
  @default_message = "You are not authorized to access this page."
end

Instance Attribute Details

#actionObject (readonly)

Returns the value of attribute action.



3
4
5
# File 'lib/c2/exceptions.rb', line 3

def action
  @action
end

#default_message=(value) ⇒ Object (writeonly)

Sets the attribute default_message

Parameters:

  • value

    the value to set the attribute default_message to.



4
5
6
# File 'lib/c2/exceptions.rb', line 4

def default_message=(value)
  @default_message = value
end

#subjectObject (readonly)

Returns the value of attribute subject.



3
4
5
# File 'lib/c2/exceptions.rb', line 3

def subject
  @subject
end

Instance Method Details

#to_sObject



12
13
14
# File 'lib/c2/exceptions.rb', line 12

def to_s
  @message || @default_message
end