Issue #1650 has been updated by Christopher Dunn.


That's not what the docs say. They are ambiguous. http://ruby-doc.org/ruby-1.9/classes/Range.html:

-  rng.cover?(val) => true or false
  Returns true if obj is between beg and end, i.e beg <= obj <= end (or end exclusive when exclude_end? is true).

-  rng.include?(val) => true or false
  Returns true if obj is an element of rng, false otherwise. If beg and end are numeric, comparison is done according magnitude of values.

-  rng === obj => true or false
  Returns true if obj is an element of rng, false otherwise. Conveniently, === is the comparison operator used by case statements.


If Range#=== works exactly the same as Range#include?, the docs should say that. If they differ when beg/end are numeric, the docs should say that. I really do not know precisely how Range#=== works from the docs, the web, or this discussion. I have to test it myself. The distinction is critical because it may dramatically impact performance of 'case' statements in the move from 1.8 to 1.9.

Please update the docs with clarification.
----------------------------------------
http://redmine.ruby-lang.org/issues/show/1650

----------------------------------------
http://redmine.ruby-lang.org