Exception: ViewModel::AccessControl::Composed::NoRequiredConditionsError
- Inherits:
-
ViewModel::AccessControlError
- Object
- StandardError
- ViewModel::AbstractError
- ViewModel::AbstractErrorWithBlame
- ViewModel::AccessControlError
- ViewModel::AccessControl::Composed::NoRequiredConditionsError
- Defined in:
- lib/view_model/access_control/composed.rb
Overview
Error type when no ‘if` conditions succeed.
Instance Attribute Summary collapse
-
#reasons ⇒ Object
readonly
Returns the value of attribute reasons.
Attributes inherited from ViewModel::AccessControlError
Attributes inherited from ViewModel::AbstractErrorWithBlame
Instance Method Summary collapse
-
#initialize(nodes, reasons) ⇒ NoRequiredConditionsError
constructor
A new instance of NoRequiredConditionsError.
- #merge(other) ⇒ Object
- #meta ⇒ Object
Methods inherited from ViewModel::AbstractError
#aggregation?, #causes, #code, #detail, #exception, #status, #title, #to_s, #view
Constructor Details
#initialize(nodes, reasons) ⇒ NoRequiredConditionsError
Returns a new instance of NoRequiredConditionsError.
83 84 85 86 |
# File 'lib/view_model/access_control/composed.rb', line 83 def initialize(nodes, reasons) super('Action not permitted because none of the possible conditions were met.', nodes) @reasons = reasons end |
Instance Attribute Details
#reasons ⇒ Object (readonly)
Returns the value of attribute reasons.
81 82 83 |
# File 'lib/view_model/access_control/composed.rb', line 81 def reasons @reasons end |
Instance Method Details
#merge(other) ⇒ Object
92 93 94 95 |
# File 'lib/view_model/access_control/composed.rb', line 92 def merge(other) NoRequiredConditionsError.new(nodes | other.nodes, Lazily.concat(reasons, other.reasons).uniq) end |
#meta ⇒ Object
88 89 90 |
# File 'lib/view_model/access_control/composed.rb', line 88 def super.merge(conditions: @reasons.to_a) end |