module Tracing::TypeCheck

Public Instance Methods

Type!(value, *types) click to toggle source
# File lib/tracing/type_check.rb, line 9
def Type!(value, *types)
  Type?(value, *types) or
    raise TypeError, "Value (#{value.class}) '#{value}' is not any of: #{types.join('; ')}."
  value
end
Type?(value, *types) click to toggle source
# File lib/tracing/type_check.rb, line 5
def Type?(value, *types)
  types.any? { |t| value.is_a? t }
end