Exception: Dry::Ability::RuleNotDefined

Inherits:
Error
  • Object
show all
Defined in:
lib/dry/ability/exceptions.rb

Constant Summary collapse

DEFAULT_MESSAGE_TEMPLATE =
"Rule for subject: %p, action: %p is not defined (candidates: %p)"
NONE =
[].freeze

Instance Method Summary collapse

Constructor Details

#initialize(message = nil, subject:, action:, candidates: NONE) ⇒ RuleNotDefined

Returns a new instance of RuleNotDefined.



15
16
17
18
19
# File 'lib/dry/ability/exceptions.rb', line 15

def initialize(message = nil, subject:, action:, candidates: NONE)
  @action, @subject = action, subject
  message ||= format(DEFAULT_MESSAGE_TEMPLATE, subject.class, action, candidates)
  super(message)
end