DockYard / valid_field

https://hex.pm/packages/valid_field
MIT License
48 stars 6 forks source link

Fix error when stringifying structs #21

Closed BlakeWilliams closed 8 years ago

BlakeWilliams commented 8 years ago

When trying to stringify a struct an error is raised because structs don't implement enumerable by default. This happens because using Kernel.is_map/1 matches both structs and maps.

The fix is to pattern match against %{__struct__: _struct} before using a guard with is_map.

Let me know if this solution works out or if there's a better alternative, thanks!

BlakeWilliams commented 8 years ago

Just pushed a change addressing the feedback.

bcardarella commented 8 years ago

Thanks! 🐥