Allow `Range#include?` on TWZ ranges #31081
In #11474 we prevented TWZ ranges being iterated over which matched Ruby's handling of Time ranges and as a consequence
+1 this seems worth pursuing. Personally it seems to me that any object which doesn't respond to
We don't even need to look at third party libraries to find them... Date and IPAddr come to mind.
(Really I think that at least
To this patch:
Do we need
I'm conscious that
@al2o3cr we are adding an extra [ruby] method invocation, so it will certainly make it slower to call... but all the important work is still in C-land. If someone's in a truly hot path, they could fall back to using
In #11474 we prevented TWZ ranges being iterated over which matched Ruby's handling of Time ranges and as a consequence `include?` stopped working with both Time ranges and TWZ ranges. However in ruby/ruby@b061634 support was added for `include?` to use `cover?` for 'linear' objects. Since we have no way of making Ruby consider TWZ instances as 'linear' we have to override `Range#include?`. Fixes #30799.