Sha256: 2b4c30f6e0ebbd7e88d8be7c997b5022dd70216454fc0e832ebac2bd381f0779
Contents?: true
Size: 853 Bytes
Versions: 5
Compression:
Stored size: 853 Bytes
Contents
module BloodContracts::Core module Ext # Refinement types representation of Sum types composition, extended version class Sum < ::BC::Sum # Sets the default failure_klass to PolicyFailure, to use # Tram::Policy::Errors for errors self.failure_klass = SumPolicyFailure # @private def self.inherited(new_klass) new_klass.failure_klass ||= failure_klass super end # Generate an PolicyFailure from the error, also stores the # additional scope for Tram::Policy::Errors in the context. # Also saves the Sum errors in the context # # @param (see BC::Refined#failure) # @return [PolicyFailure] # def failure(*, **) @context[:sum_errors] = @or_matches @context[:sub_scope] = self.class.name super end end end end
Version data entries
5 entries across 5 versions & 1 rubygems