range.c: [DOC] improve docs for Range#cover?
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65041 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
08d01949bf
commit
863a2a1fc8
11
range.c
11
range.c
@ -1360,15 +1360,16 @@ static int r_cover_range_p(VALUE range, VALUE beg, VALUE end, VALUE val);
|
|||||||
* This tests <code>begin <= obj <= end</code> when #exclude_end? is +false+
|
* This tests <code>begin <= obj <= end</code> when #exclude_end? is +false+
|
||||||
* and <code>begin <= obj < end</code> when #exclude_end? is +true+.
|
* and <code>begin <= obj < end</code> when #exclude_end? is +true+.
|
||||||
*
|
*
|
||||||
* Returns <code>true</code> for a Range when it is covered by the reciver,
|
* If called with a Range argument, returns <code>true</code> when the
|
||||||
|
* given range is covered by the receiver,
|
||||||
* by comparing the begin and end values. If the argument can be treated as
|
* 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 sequence, this method treats it that way. In the specific case of
|
||||||
* <code>(a..b).cover?(c...d)</code> with <code>a <= c && b < d</code>,
|
* <code>(a..b).cover?(c...d)</code> with <code>a <= c && b < d</code>,
|
||||||
* end of sequence must be calculated, which may exhibit poor performance if
|
* the end of the sequence must be calculated, which may exhibit poor
|
||||||
* c is non-numeric. Returns <code>false</code> if the begin value of the
|
* performance if <code>c</code> is non-numeric.
|
||||||
* Range is larger than the end value.
|
* Returns <code>false</code> if the begin value of the
|
||||||
|
* range is larger than the end value.
|
||||||
*
|
*
|
||||||
* Return
|
|
||||||
* ("a".."z").cover?("c") #=> true
|
* ("a".."z").cover?("c") #=> true
|
||||||
* ("a".."z").cover?("5") #=> false
|
* ("a".."z").cover?("5") #=> false
|
||||||
* ("a".."z").cover?("cc") #=> true
|
* ("a".."z").cover?("cc") #=> true
|
||||||
|
Loading…
x
Reference in New Issue
Block a user