dry-rb / dry-logic

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

Adding predicates to support min_bytesize? max_bytesize? and bytesize? #59

Closed bmalinconico closed 5 years ago

bmalinconico commented 5 years ago

This is a fairly simple enhancement to validate the byteszie of my string input, not just the character count.

irb(main):017:0> 'こ'.size
=> 1
irb(main):018:0> 'こ'.bytesize
=> 3

It follows the same form as min_size?, max_size?, and size? predicates.

For documentation purposes should I open a pr with? https://github.com/dry-rb/dry-rb.org Follow up: Add integration test to dry-schema

bmalinconico commented 5 years ago

I can address the code climate issues with the size? and bytesize? methods being essentially the same, but i think that would hurt readability.

solnic commented 5 years ago

For documentation purposes should I open a pr with? https://github.com/dry-rb/dry-rb.org

Yes please