method

cover?

rails latest stable - Class: ActiveSupport::CompareWithRange

Method deprecated or moved

This method is deprecated or moved on the latest stable version. The last existing version (v6.1.7.7) is shown here.

cover?(value)
public

Extends the default Range#cover? to support range comparisons.

(1..5).cover?(1..5)  # => true
(1..5).cover?(2..3)  # => true
(1..5).cover?(1...6) # => true
(1..5).cover?(2..6)  # => false

The native Range#cover? behavior is untouched.

('a'..'f').cover?('c') # => true
(5..9).cover?(11) # => false

The given range must be fully bounded, with both start and end.