Exception: SafetyPatrol::Padrino::SafteyViolation

Inherits:
StandardError
  • Object
show all
Defined in:
lib/safety_patrol/padrino/safety_violation.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(user, action, resource) ⇒ SafteyViolation

Returns a new instance of SafteyViolation.



9
10
11
12
13
# File 'lib/safety_patrol/padrino/safety_violation.rb', line 9

def initialize(user, action, resource)
	@user = user
	@action = action
	@resource = resource
end

Instance Attribute Details

#actionObject (readonly)

Returns the value of attribute action.



7
8
9
# File 'lib/safety_patrol/padrino/safety_violation.rb', line 7

def action
  @action
end

#resourceObject (readonly)

Returns the value of attribute resource.



7
8
9
# File 'lib/safety_patrol/padrino/safety_violation.rb', line 7

def resource
  @resource
end

#userObject (readonly)

Returns the value of attribute user.



7
8
9
# File 'lib/safety_patrol/padrino/safety_violation.rb', line 7

def user
  @user
end

Instance Method Details

#messageObject



15
16
17
# File 'lib/safety_patrol/padrino/safety_violation.rb', line 15

def message
	"#{@user.class} is not authorized to #{@action} this resource: #{@resource.class}"
end