jeudi 19 avril 2018

how to correctly assert struct type in elixir

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{}

Aucun commentaire:

Enregistrer un commentaire