Flowdock
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
Show source
Register or log in to add new notes.