summaryrefslogtreecommitdiff
path: root/enum.c
diff options
context:
space:
mode:
Diffstat (limited to 'enum.c')
-rw-r--r--enum.c51
1 files changed, 25 insertions, 26 deletions
diff --git a/enum.c b/enum.c
index d3df6e5b94..c25b17f383 100644
--- a/enum.c
+++ b/enum.c
@@ -1123,10 +1123,10 @@ sort_by_cmp(const void *ap, const void *bp, void *data)
* %w{apple pear fig}.sort_by { |word| word.length }
* #=> ["fig", "pear", "apple"]
*
- * The current implementation of <code>sort_by</code> generates an
- * array of tuples containing the original collection element and the
- * mapped value. This makes <code>sort_by</code> fairly expensive when
- * the keysets are simple.
+ * The current implementation of #sort_by generates an array of
+ * tuples containing the original collection element and the mapped
+ * value. This makes #sort_by fairly expensive when the keysets are
+ * simple.
*
* require 'benchmark'
*
@@ -1145,15 +1145,15 @@ sort_by_cmp(const void *ap, const void *bp, void *data)
*
* However, consider the case where comparing the keys is a non-trivial
* operation. The following code sorts some files on modification time
- * using the basic <code>sort</code> method.
+ * using the basic #sort method.
*
* files = Dir["*"]
* sorted = files.sort { |a, b| File.new(a).mtime <=> File.new(b).mtime }
* sorted #=> ["mon", "tues", "wed", "thurs"]
*
- * This sort is inefficient: it generates two new <code>File</code>
+ * This sort is inefficient: it generates two new File
* objects during every comparison. A slightly better technique is to
- * use the <code>Kernel#test</code> method to generate the modification
+ * use the Kernel#test method to generate the modification
* times directly.
*
* files = Dir["*"]
@@ -1162,20 +1162,20 @@ sort_by_cmp(const void *ap, const void *bp, void *data)
* }
* sorted #=> ["mon", "tues", "wed", "thurs"]
*
- * This still generates many unnecessary <code>Time</code> objects. A
- * more efficient technique is to cache the sort keys (modification
- * times in this case) before the sort. Perl users often call this
- * approach a Schwartzian transform, after Randal Schwartz. We
- * construct a temporary array, where each element is an array
- * containing our sort key along with the filename. We sort this array,
- * and then extract the filename from the result.
+ * This still generates many unnecessary Time objects. A more
+ * efficient technique is to cache the sort keys (modification times
+ * in this case) before the sort. Perl users often call this approach
+ * a Schwartzian transform, after Randal Schwartz. We construct a
+ * temporary array, where each element is an array containing our
+ * sort key along with the filename. We sort this array, and then
+ * extract the filename from the result.
*
* sorted = Dir["*"].collect { |f|
* [test(?M, f), f]
* }.sort.collect { |f| f[1] }
* sorted #=> ["mon", "tues", "wed", "thurs"]
*
- * This is exactly what <code>sort_by</code> does internally.
+ * This is exactly what #sort_by does internally.
*
* sorted = Dir["*"].sort_by { |f| test(?M, f) }
* sorted #=> ["mon", "tues", "wed", "thurs"]
@@ -1716,7 +1716,7 @@ min_ii(RB_BLOCK_CALL_FUNC_ARGLIST(i, args))
* enum.min(n) { |a, b| block } -> array
*
* Returns the object in _enum_ with the minimum value. The
- * first form assumes all objects implement <code>Comparable</code>;
+ * first form assumes all objects implement Comparable;
* the second uses the block to return <em>a <=> b</em>.
*
* a = %w(albatross dog horse)
@@ -1808,7 +1808,7 @@ max_ii(RB_BLOCK_CALL_FUNC_ARGLIST(i, args))
* enum.max(n) { |a, b| block } -> array
*
* Returns the object in _enum_ with the maximum value. The
- * first form assumes all objects implement <code>Comparable</code>;
+ * first form assumes all objects implement Comparable;
* the second uses the block to return <em>a <=> b</em>.
*
* a = %w(albatross dog horse)
@@ -1967,7 +1967,7 @@ minmax_ii(RB_BLOCK_CALL_FUNC_ARGLIST(i, _memo))
*
* Returns a two element array which contains the minimum and the
* maximum value in the enumerable. The first form assumes all
- * objects implement <code>Comparable</code>; the second uses the
+ * objects implement Comparable; the second uses the
* block to return <em>a <=> b</em>.
*
* a = %w(albatross dog horse)
@@ -4070,14 +4070,13 @@ enum_uniq(VALUE obj)
}
/*
- * The <code>Enumerable</code> mixin provides collection classes with
- * several traversal and searching methods, and with the ability to
- * sort. The class must provide a method <code>each</code>, which
- * yields successive members of the collection. If
- * <code>Enumerable#max</code>, <code>#min</code>, or
- * <code>#sort</code> is used, the objects in the collection must also
- * implement a meaningful <code><=></code> operator, as these methods
- * rely on an ordering between members of the collection.
+ * The Enumerable mixin provides collection classes with several
+ * traversal and searching methods, and with the ability to sort. The
+ * class must provide a method #each, which yields
+ * successive members of the collection. If Enumerable#max, #min, or
+ * #sort is used, the objects in the collection must also implement a
+ * meaningful <code><=></code> operator, as these methods rely on an
+ * ordering between members of the collection.
*/
void