Sha256: 9004770a614d207efecfac4ce74b6359c3c16fa10c6a039038001dac85c34ed0
Contents?: true
Size: 544 Bytes
Versions: 6
Compression:
Stored size: 544 Bytes
Contents
require "dry-types" require_relative "./type_interface" module Kanji module Types class Callable extend TypeInterface class << self def call(obj) raise constraint_error(obj) unless valid?(obj) obj end def valid?(obj) obj.respond_to?(:call) end private def constraint_error(obj) Dry::Types::ConstraintError.new( "Object must respond to the call method", obj ) end end end end end
Version data entries
6 entries across 6 versions & 1 rubygems