Exception: SelfControl::AccessDenied

Inherits:
Error
  • Object
show all
Defined in:
lib/self-control/exceptions.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of AccessDenied.



10
11
12
13
14
15
16
# File 'lib/self-control/exceptions.rb', line 10

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

Instance Attribute Details

#actionObject (readonly)

Returns the value of attribute action.



7
8
9
# File 'lib/self-control/exceptions.rb', line 7

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.



8
9
10
# File 'lib/self-control/exceptions.rb', line 8

def default_message=(value)
  @default_message = value
end

#stepObject (readonly)

Returns the value of attribute step.



7
8
9
# File 'lib/self-control/exceptions.rb', line 7

def step
  @step
end

#subjectObject (readonly)

Returns the value of attribute subject.



7
8
9
# File 'lib/self-control/exceptions.rb', line 7

def subject
  @subject
end

Instance Method Details

#to_sObject



18
19
20
# File 'lib/self-control/exceptions.rb', line 18

def to_s
  @message || @default_message
end