I'm trying to implement a fucntion:
def foo(t : Class)
if t in Int::Signed
# ...
end
end
But how to implement t in Int::Signed
? Where Int::Signed
I know is_a?(Int::Signed)
but here the parameter is of type Type
.
Thanks.
def foo(t : Class)
if t < Int::Signed
# ...
end
end
Class#<
is only added in Crystal 0.25, if I am not mistaken, so make sure you update if it does not work for you. There is also Class#<=
that would return true
for Int::Signed <= Int::Signed
.