I agree that the max performance issue is likely to be a rare case; I am happy to leave it as-is. Apologies on the second issue - I originally misunderstood "ignore" to mean "don't rescue". I've attached another updated patch - it ...owst (Owen Stephens)
Hi tarui, thank you for reviewing and your suggestion/question. In fact, with my v4 patch in the case you describe there is a bug: `(1..3).cover?(1.0...4.0)` is `true` not `false`. This is prevented using `b >= (c...d).max` as you su...owst (Owen Stephens)
Thank you for your proposal Matz, having thought about it over the last few months, I agree. I have updated my patch accordingly (which has greatly simplified/improved it), I welcome any comments.owst (Owen Stephens)
Hi, As mentioned in https://bugs.ruby-lang.org/issues/14473#note-17 an addition to Range that we find useful is an `Range#offset(n)` method that adds (or subtracts) `n` to the range, for example: ~~~ruby (1..10).offset(2) # => (...owst (Owen Stephens)
Hi Matz! A slightly contrived example - imagine we want to filter candidates for a new job position and harshly reject any who have a salary requirement that is not covered by our predetermined position salary range: ~~~ruby Candi...owst (Owen Stephens)
I've attached an updated patch; it includes the renamed (by `s/set/range/`) methods and a performance improvement for `strict_subset?` (before, we would calculate `max` on the receiver twice, which is potentially slow when the receiver ...owst (Owen Stephens)
Are there any further thoughts on my latest patch? Based on the discussion above, I think I should rename the added methods: `s/set/range/` and perhaps also prevent the "bad performance" cases where either range has `exclude_end?` true a...owst (Owen Stephens)
Good point v.ox, I did consider implementing `subset?` as an overloading of `include?` (or possibly `cover?` ?), as one can't have a range-of-ranges (so there is no ambiguity). How would you distinguish between strict/non-strict - a `...owst (Owen Stephens)
Thanks for your thoughts al2o3cr, your "bigger point" is interesting: > So range_1 claims to be a subset of range_2, but no elements of range_2 are included in range_1. My thinking here was that the empty set is a subset of all set...owst (Owen Stephens)