From: zverok.offline@... Date: 2020-12-21T09:18:55+00:00 Subject: [ruby-core:101575] [Ruby master Bug#17409] Endless range of dates stuck on include? when miss Issue #17409 has been updated by zverok (Victor Shepelev). @gsmetal > This case with endless ranges should be at least somehow mentioned in include? documentation, I think. Actually, I agree the documentation should be clearer not just about endless range, but about the fact that `include?` invokes iteration. It mentions > If you need to ensure obj is between begin and end, use `cover?` > ... > If begin and end are numeric, `include?` behaves like `cover?` ...but the fact that **enumeration would be involved** is not clear. I'll handle it at some point in the upcoming weeks. ---------------------------------------- Bug #17409: Endless range of dates stuck on include? when miss https://bugs.ruby-lang.org/issues/17409#change-89360 * Author: gsmetal (Sergey G) * Status: Rejected * Priority: Normal * ruby -v: ruby 2.7.1p83 (2020-03-31 revision a0c7c23c9c) [x86_64-linux] * Backport: 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN ---------------------------------------- This code stucks (on latest ruby 2.7.1): ```ruby require 'date' (Date.today..).include?(Date.today - 1) ``` But it works well with `cover?`: ```ruby 2.7.1 :001 > require 'date' => true 2.7.1 :002 > (Date.today..).cover?(Date.today - 1) => false ``` -- https://bugs.ruby-lang.org/ Unsubscribe: