summaryrefslogtreecommitdiff
path: root/array.c
diff options
context:
space:
mode:
authorBurdetteLamar <[email protected]>2024-10-17 16:51:26 -0500
committerPeter Zhu <[email protected]>2024-10-18 11:08:43 -0400
commit161ea389af16f33db25a96ad7ee970bee3a3defe (patch)
tree620880d3ec7302c859ae9311220b69455f8054b0 /array.c
parenteb8cf1d60e4436bfebf52fbf4342ee6e5e18ba05 (diff)
[DOC] Tweaks for Array#sort_by!
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/11914
Diffstat (limited to 'array.c')
-rw-r--r--array.c20
1 files changed, 8 insertions, 12 deletions
diff --git a/array.c b/array.c
index 52e103989b..48614e1ecd 100644
--- a/array.c
+++ b/array.c
@@ -3556,28 +3556,24 @@ sort_by_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, dummy))
/*
* call-seq:
- * array.sort_by! {|element| ... } -> self
- * array.sort_by! -> new_enumerator
+ * sort_by! {|element| ... } -> self
+ * sort_by! -> new_enumerator
*
- * Sorts the elements of +self+ in place,
- * using an ordering determined by the block; returns self.
+ * With a block given, sorts the elements of +self+ in place;
+ * returns self.
*
* Calls the block with each successive element;
- * sorts elements based on the values returned from the block.
- *
- * For duplicates returned by the block, the ordering is indeterminate, and may be unstable.
- *
- * This example sorts strings based on their sizes:
+ * sorts elements based on the values returned from the block:
*
* a = ['aaaa', 'bbb', 'cc', 'd']
* a.sort_by! {|element| element.size }
* a # => ["d", "cc", "bbb", "aaaa"]
*
- * Returns a new Enumerator if no block given:
+ * For duplicate values returned by the block, the ordering is indeterminate, and may be unstable.
*
- * a = ['aaaa', 'bbb', 'cc', 'd']
- * a.sort_by! # => #<Enumerator: ["aaaa", "bbb", "cc", "d"]:sort_by!>
+ * With no block given, returns a new Enumerator.
*
+ * Related: see {Methods for Assigning}[rdoc-ref:Array@Methods+for+Assigning].
*/
static VALUE