dashbitco / nimble_options

A tiny library for validating and documenting high-level options. 💽
Apache License 2.0
507 stars 38 forks source link

add `Range` support for `{:in, choices}` type #71

Closed dcrck closed 3 years ago

dcrck commented 3 years ago

Ranges implement Enumerable and support in, so you should be able to use them with the {:in, choices} type.

For example, to check if a value is a byte:

schema = [decimals: [type: {:in, 0..255}]]

This commit adds that support.

josevalim commented 3 years ago

Looks good, thanks! We just need a test and I think we are good to go!

/cc @whatyouhide good to you too?

dcrck commented 3 years ago

added some tests