Additional array methods: subtract and intersection with array
Thanks for putting this gem together, really useful!
I have a peculiar use case working with DateTimes, and I'm glad to say that this gem seems to be working just fine.
It'd be interesting to write a .subtract method on Array with signature subtract(Array<Range>, Array<Range>):Array<Range>, where the result is the first array of ranges subtracted by each of the ranges in the second array. See https://en.wikipedia.org/wiki/Subtraction
It'd also be interesting to write an .intersection method on Array with signature intersection(Array<Range>, Array<Range>):Array<Range>, where the result is first array's of ranges' intersections with each of the ranges in the second array.
I've been looking into using this Gem for a project and figured out a way to perform an operation similar to intersection(Array<Range>, Array<Range>):Array<Range>.
Array<Range>.product(Array<Range>).map(&:intersection).rangify
for example
[2, (3..4)].product([(1..3)]).map(&:intersection).rangify => [2..3]