dry-rb / dry-logic

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

Add match? predicate #34

Closed flash-gordon closed 7 years ago

flash-gordon commented 7 years ago

@solnic I did this, but I'm very unsure now, this looks like too generic. Anyway, my class has a custom === method and I want to match values with that, soooo, can we have it? If not, just close :)

solnic commented 7 years ago

I find this very confusing, as you pointed out this feels too generic. ie when I see match? I think about regex, in fact I had no idea there's Regex#=== that can be used against a string.

timriley commented 7 years ago

I wonder if it'd be clearer if we called it #case?

solnic commented 7 years ago

Yeah, I like this idea Tim. This does require you to understand how case statements work, but that's OK.

flash-gordon commented 7 years ago

OK, I like the idea, I updated the name. Range also has #=== btw :)