Sha256: f32dba6e9ffb06be8718bb185d1d546d3e10323d25fba6d2d4ecbc0d83d276cf

Contents?: true

Size: 1 KB

Versions: 1

Compression:

Stored size: 1 KB

Contents

# frozen_string_literal: true

# @api private
# @since 0.2.0
class SmartCore::Types::Primitive::MultValidator < SmartCore::Types::Primitive::SumValidator
  require_relative 'mult_validator/result'

  # @overload validate(value)
  #   @param value [Any]
  #   @return [SmartCore::Types::Primitive::MultValidator::Result]
  #
  # @api private
  # @since 0.2.0

  private

  # @param validation [Block]
  # @yieldparam [void]
  # @yieldreturn [SmartCore::Engine::Atom]
  # @return [SmartCore::Types::Primitive::MultValidator::Result]
  #
  # @api private
  # @since 0.2.0
  def compile_validation_result(&validation)
    # NOTE: at this moment type sum does not support invariant checking
    # TODO (0.x.0):
    #   @yieldreturn [SmartCore::Types::Primitive::Validator::Result]
    #   => and:
    #   SmartCore::Types::Primitive::MultValidator::Result.new(
    #     type, final_result.value, final_result.value.invariant_errors
    #   )
    SmartCore::Types::Primitive::MultValidator::Result.new(type, yield.value)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
smart_types-0.2.0 lib/smart_core/types/primitive/mult_validator.rb