mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
[DOC] Add pound sign before all <=> methods
This commit is contained in:
parent
66124cdb17
commit
f56be4286f
Notes:
git
2024-10-03 13:28:31 +00:00
4 changed files with 33 additions and 33 deletions
20
range.c
20
range.c
|
@ -1471,7 +1471,7 @@ range_last(int argc, VALUE *argv, VALUE range)
|
|||
* min(n) {|a, b| ... } -> array
|
||||
*
|
||||
* Returns the minimum value in +self+,
|
||||
* using method <tt><=></tt> or a given block for comparison.
|
||||
* using method <tt>#<=></tt> or a given block for comparison.
|
||||
*
|
||||
* With no argument and no block given,
|
||||
* returns the minimum-valued element of +self+.
|
||||
|
@ -1579,7 +1579,7 @@ range_min(int argc, VALUE *argv, VALUE range)
|
|||
* max(n) {|a, b| ... } -> array
|
||||
*
|
||||
* Returns the maximum value in +self+,
|
||||
* using method <tt><=></tt> or a given block for comparison.
|
||||
* using method <tt>#<=></tt> or a given block for comparison.
|
||||
*
|
||||
* With no argument and no block given,
|
||||
* returns the maximum-valued element of +self+.
|
||||
|
@ -1698,10 +1698,10 @@ range_max(int argc, VALUE *argv, VALUE range)
|
|||
* minmax {|a, b| ... } -> [object, object]
|
||||
*
|
||||
* Returns a 2-element array containing the minimum and maximum value in +self+,
|
||||
* either according to comparison method <tt><=></tt> or a given block.
|
||||
* either according to comparison method <tt>#<=></tt> or a given block.
|
||||
*
|
||||
* With no block given, returns the minimum and maximum values,
|
||||
* using <tt><=></tt> for comparison:
|
||||
* using <tt>#<=></tt> for comparison:
|
||||
*
|
||||
* (1..4).minmax # => [1, 4]
|
||||
* (1...4).minmax # => [1, 3]
|
||||
|
@ -2151,7 +2151,7 @@ static int r_cover_range_p(VALUE range, VALUE beg, VALUE end, VALUE val);
|
|||
* Returns +false+ if either:
|
||||
*
|
||||
* - The begin value of +self+ is larger than its end value.
|
||||
* - An internal call to <tt><=></tt> returns +nil+;
|
||||
* - An internal call to <tt>#<=></tt> returns +nil+;
|
||||
* that is, the operands are not comparable.
|
||||
*
|
||||
* Beginless ranges cover all values of the same type before the end,
|
||||
|
@ -2399,7 +2399,7 @@ empty_region_p(VALUE beg, VALUE end, int excl)
|
|||
*
|
||||
* (1..3).overlap?(1) # TypeError
|
||||
*
|
||||
* Returns +false+ if an internal call to <tt><=></tt> returns +nil+;
|
||||
* Returns +false+ if an internal call to <tt>#<=></tt> returns +nil+;
|
||||
* that is, the operands are not comparable.
|
||||
*
|
||||
* (1..3).overlap?('a'..'d') # => false
|
||||
|
@ -2589,7 +2589,7 @@ range_overlap(VALUE range, VALUE other)
|
|||
* == Ranges and Other Classes
|
||||
*
|
||||
* An object may be put into a range if its class implements
|
||||
* instance method <tt><=></tt>.
|
||||
* instance method <tt>#<=></tt>.
|
||||
* Ruby core classes that do so include Array, Complex, File::Stat,
|
||||
* Float, Integer, Kernel, Module, Numeric, Rational, String, Symbol, and Time.
|
||||
*
|
||||
|
@ -2621,15 +2621,15 @@ range_overlap(VALUE range, VALUE other)
|
|||
* == Ranges and User-Defined Classes
|
||||
*
|
||||
* A user-defined class that is to be used in a range
|
||||
* must implement instance <tt><=></tt>;
|
||||
* must implement instance <tt>#<=></tt>;
|
||||
* see Integer#<=>.
|
||||
* To make iteration available, it must also implement
|
||||
* instance method +succ+; see Integer#succ.
|
||||
*
|
||||
* The class below implements both <tt><=></tt> and +succ+,
|
||||
* The class below implements both <tt>#<=></tt> and +succ+,
|
||||
* and so can be used both to construct ranges and to iterate over them.
|
||||
* Note that the Comparable module is included
|
||||
* so the <tt>==</tt> method is defined in terms of <tt><=></tt>.
|
||||
* so the <tt>==</tt> method is defined in terms of <tt>#<=></tt>.
|
||||
*
|
||||
* # Represent a string of 'X' characters.
|
||||
* class Xs
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue