class BloodContracts::Core::Ext::Refined

Refinement type exteneded with Extractable, ExceptionHandling and errors representation in form of Tram::Policy::Errors

Public Class Methods

>(other_type)

Alias for Pipe compose See and_then

Alias for: and_then
and_then(other_type) click to toggle source

Compose types in a Pipe check Pipe passes data from type to type sequentially

@return [BC::Pipe]

# File lib/blood_contracts/ext/refined.rb, line 43
def and_then(other_type)
  BC::Ext::Pipe.new(self, other_type)
end
Also aliased as: >
inherited(new_klass) click to toggle source

@private

Calls superclass method
# File lib/blood_contracts/ext/refined.rb, line 52
def inherited(new_klass)
  new_klass.failure_klass ||= failure_klass
  new_klass.prepend ExceptionHandling
  super
end
or_a(other_type) click to toggle source

Compose types in a Sum check Sum passes data from type to type in parallel, only one type have to match

@return [BC::Sum]

# File lib/blood_contracts/ext/refined.rb, line 26
def or_a(other_type)
  BC::Ext::Sum.new(self, other_type)
end
Also aliased as: or_an, |
or_an(other_type)

Alias for Sum compose See or_a

Alias for: or_a
|(other_type)

Alias for Sum compose See or_a

Alias for: or_a

Public Instance Methods

failure(*, **) click to toggle source

Generate an PolicyFailure from the error, also stores the additional scope for Tram::Policy::Errors in the context

@param (see BC::Refined#failure) @return [PolicyFailure]

Calls superclass method
# File lib/blood_contracts/ext/refined.rb, line 65
def failure(*, **)
  @context[:sub_scope] = self.class.name
  super
end