dry-rb / dry-logic

Predicate logic with rule composition
https://dry-rb.org/gems/dry-logic/
MIT License
179 stars 66 forks source link

nil input causes predicate errors #10

Closed fran-worley closed 8 years ago

fran-worley commented 8 years ago

Moved from dry-validation see https://github.com/dry-rb/dry-validation/issues/150

For :includes and :excludes and predicates I propose the following handling of nil and unsupported input types (e.g. Integers)

Includes should return false as the input cannot include the desired value Excludes should return true as for the same reason as the above.

A greater discussion should be had around other predicates where this may apply (e.g. :gt, :lt etc.)

jodosha commented 8 years ago

@fran-worley interface checking is the right thing to do. 👍