Sha256: 836a04ad58bbeb105e84510a8e125b089fb176f984723327f2415784647d980c

Contents?: true

Size: 837 Bytes

Versions: 7

Compression:

Stored size: 837 Bytes

Contents

# frozen_string_literal: true

# @api private
# @since 0.1.0
class SmartCore::Types::Primitive::Factory::DefinitionContext
  # @return [Proc]
  #
  # @api private
  # @since 0.1.0
  attr_reader :type_checker

  # @return [Proc]
  #
  # @api private
  # @since 0.1.0
  attr_reader :type_caster

  # @return [void]
  #
  # @api private
  # @since 0.1.0
  def initialize
    @type_checker = nil
    @type_caster = nil
  end

  # @param checker [Block]
  # @return [void]
  #
  # @api public
  # @since 0.1.0
  def define_checker(&checker)
    raise 'No checker definition block' unless block_given?
    @type_checker = checker
  end

  # @param caster [Block]
  # @return [void]
  #
  # @api public
  # @since 0.1.0
  def define_caster(&caster)
    raise 'No caster definition block' unless block_given?
    @type_caster = caster
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
smart_types-0.1.0.alpha6 lib/smart_core/types/primitive/factory/definition_context.rb
smart_types-0.1.0.alpha5 lib/smart_core/types/primitive/factory/definition_context.rb
smart_types-0.1.0.alpha4 lib/smart_core/types/primitive/factory/definition_context.rb
smart_types-0.1.0.alpha3 lib/smart_core/types/primitive/factory/definition_context.rb
smart_types-0.1.0.alpha2 lib/smart_core/types/primitive/factory/definition_context.rb
smart_types-0.1.0.alpha lib/smart_core/types/primitive/factory/definition_context.rb
smart_types-0.0.0 lib/smart_core/types/primitive/factory/definition_context.rb