`Range#cover` does not raise an exception when comparison fails
The documentation for
cover?(obj) → true or false Returns true if obj is between the begin and end of the range. This tests begin <= obj <= end when exclude_end? is false and begin <= obj < end when exclude_end? is true.
which implies that, when comparison fails,
cover? should raise an error. But actually, it doesn't:
"a" <= 1 # => ArgumentError: comparison of String with 1 failed 1 <= "a" # => ArgumentError: comparison of Fixnum with String failed ("a".."z").cover?(1) # => false
It silently returns
false instead of raising an error.
Range#cover? should raise an error when comparison fails, or the documentation should be changed to correctly describe this behaviour.