diff options
author | Victor Shepelev <[email protected]> | 2023-12-14 23:01:48 +0200 |
---|---|---|
committer | GitHub <[email protected]> | 2023-12-14 23:01:48 +0200 |
commit | 570d7b2c3e2ee39e07548dfe242b684ec794789d (patch) | |
tree | ee123eb1d1a8680ee9fd5f7c7a873a120acd833d /range.c | |
parent | d3deb1b8232a303dd40909e32f939bad3b24a8af (diff) |
[DOC] Adjust some new features wording/examples. (#9183)
* Reword Range#overlap? docs last paragraph.
* Docs: add explanation about Queue#freeze
* Docs: Add :rescue event docs for TracePoint
* Docs: Enhance Module#set_temporary_name documentation
* Docs: Slightly expand Process::Status deprecations
* Fix MatchData#named_captures rendering glitch
* Improve Dir.fchdir examples
* Adjust Refinement#target docs
Diffstat (limited to 'range.c')
-rw-r--r-- | range.c | 23 |
1 files changed, 11 insertions, 12 deletions
@@ -2391,18 +2391,17 @@ empty_region_p(VALUE beg, VALUE end, int excl) * (1..2).overlap?(3..4) # => false * (1...3).overlap?(3..4) # => false * - * This method assumes that there is no minimum value because - * Ruby lacks a standard method for determining minimum values. - * This assumption is invalid. - * For example, there is no value smaller than <tt>-Float::INFINITY</tt>, - * making <tt>(...-Float::INFINITY)</tt> an empty set. - * Consequently, <tt>(...-Float::INFINITY)</tt> has no elements in common with itself, - * yet <tt>(...-Float::INFINITY).overlap?((...-Float::INFINITY))<tt> returns - * +true+ due to this assumption. - * In general, if <tt>r = (...minimum); r.overlap?(r)</tt> returns +true+, - * where +minimum+ is a value that no value is smaller than. - * Such values include <tt>-Float::INFINITY</tt>, <tt>[]</tt>, <tt>""</tt>, and - * classes without subclasses. + * Note that the method wouldn't make any assumptions about the beginless + * range being actually empty, even if its upper bound is the minimum + * possible value of its type, so all this would return +true+: + * + * (...-Float::INFINITY).overlap?(...-Float::INFINITY) # => true + * (..."").overlap?(..."") # => true + * (...[]).overlap?(...[]) # => true + * + * Even if those ranges are effectively empty (no number can be smaller than + * <tt>-Float::INFINITY</tt>), they are still considered overlapping + * with themselves. * * Related: Range#cover?. */ |