method

cover?

Importance_1
Ruby on Rails latest stable (v7.1.3.2) - 0 notes - Class: 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.

Show source
Register or log in to add new notes.