I know you can assert a type struct like this (althought its more a module assert):
assert foo.__struct__ == Foo
But is there a more elegant way to do this? something like:
assert type(foo) == %Foo{}
You can use =
and pattern matching:
assert %Foo{} = foo
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With