cover?
- 1_8_6_287
- 1_8_7_72
- 1_8_7_330
- 1_9_1_378 (0)
- 1_9_2_180 (0)
- 1_9_3_125 (0)
- 1_9_3_392 (0)
- 2_1_10 (6)
- 2_2_9 (0)
- 2_4_6 (0)
- 2_5_5 (0)
- 2_6_3 (38)
- What's this?
cover?(p1)
public
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.
If called with a Range argument, returns true when the given range is covered by the receiver, by comparing the begin and end values. If the argument can be treated as a sequence, this method treats it that way. In the specific case of (a..b).cover?(c…d) with a <= c && b < d, the end of the sequence must be calculated, which may exhibit poor performance if c is non-numeric. Returns false if the begin value of the range is larger than the end value.
("a".."z").cover?("c") #=> true ("a".."z").cover?("5") #=> false ("a".."z").cover?("cc") #=> true (1..5).cover?(2..3) #=> true (1..5).cover?(0..6) #=> false (1..5).cover?(1...6) #=> true