Sha256: a8352828a988d81a27b53c6e1e7427f9ac157f19ce9cb3783065e7013edb9984

Contents?: true

Size: 653 Bytes

Versions: 2

Compression:

Stored size: 653 Bytes

Contents

require 'dry-types'
require 'atacama/version'
require 'atacama/contract'
require 'atacama/transaction'
require 'atacama/step'

module Atacama
  OptionTypeMismatchError = Class.new(StandardError)
  ReturnTypeMismatchError = Class.new(StandardError)
  ResultTypeMismatchError = Class.new(StandardError)

  # Execute a type check, catch and yield if theres an error.
  #
  # @yields [Exception] the caught type error
  #
  # @param type [Dry::Types?] type to check
  # @param value [Object] object to execute with
  def self.check(type, value)
    type && type[value]
    nil
  rescue Dry::Types::ConstraintError => exception
    yield exception
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
atacama-0.1.9 lib/atacama.rb
atacama-0.1.8 lib/atacama.rb