Sha256: 725a98d104c8aa4a41f83ab152e19b9415ca082506b9e7fceb1427c39a83487b
Contents?: true
Size: 1.21 KB
Versions: 1
Compression:
Stored size: 1.21 KB
Contents
module Kindergarten # Signals unallowed access class AccessDenied < CanCan::AccessDenied def initialize(action, target, opts) message = opts.delete(:message) if message.blank? name = target.is_a?(Class) ? target.name : target.class.name message = "You are not allowed to #{action} that #{name.downcase}" end super(message, action, target) end end class Sandbox class NoPurposeError < NoMethodError def initialize(purpose, sandbox) @purpose = purpose @sandbox = sandbox end def to_s "undefined purpose '#{@purpose}' for #{@sandbox}" end end end class Perimeter class NoExposedMethods < NoMethodError def initialize(perimeter) @perimeter = perimeter super end def to_s "The module #{@perimeter.name} does not expose any methods." end end class NoPurpose < ArgumentError def initialize(perimeter) @perimeter = perimeter super end def to_s "The module #{@perimeter.name} does not have a purpose." end end # Signals bad sandbox method implementation class Unguarded < SecurityError; end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
kindergarten-0.1.0 | lib/kindergarten/exceptions.rb |