Sha256: 9c80c983660554cc501b6741abcd90dc72d5842fff6136e1ec72d73e9295d1c7
Contents?: true
Size: 429 Bytes
Versions: 1
Compression:
Stored size: 429 Bytes
Contents
module Test module TypeCheck class NullError < StandardError; end def Type?(value, *types) types.any? { |t| value.is_a? t } end def Type!(value, *types) Type?(value, *types) or raise TypeError, "Value (#{value.class}) '#{value}' is not any of: #{types.join('; ')}." value end def NotNull!(value) raise NullError, "Value must not be nil" unless value end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
test-tracer-1.0.0 | lib/test/type_check.rb |