Class: BloodContracts::Core::Ext::Tuple
- Inherits:
-
BC::Tuple
- Object
- BC::Tuple
- BloodContracts::Core::Ext::Tuple
- Defined in:
- lib/blood_contracts/ext/tuple.rb
Overview
Refinement types representation of Sum types composition, extended version
Class Method Summary collapse
Instance Method Summary collapse
-
#failure ⇒ PolicyFailure
Generate an PolicyFailure from the error, also stores the additional scope for Tram::Policy::Errors in the context.
Class Method Details
.inherited(new_klass) ⇒ Object
10 11 12 13 |
# File 'lib/blood_contracts/ext/tuple.rb', line 10 def self.inherited(new_klass) new_klass.failure_klass ||= failure_klass super end |
Instance Method Details
#failure ⇒ PolicyFailure
Generate an PolicyFailure from the error, also stores the additional scope for Tram::Policy::Errors in the context. Also saves the Tuple error in the context by the :base key
22 23 24 25 |
# File 'lib/blood_contracts/ext/tuple.rb', line 22 def failure(*, **) @context[:sub_scope] = self.class.name super end |