From 56557ec28a8712984a0e9744fd7547e797ec9b6b Mon Sep 17 00:00:00 2001 From: nobu Date: Fri, 22 Mar 2019 11:04:59 +0000 Subject: [DOC] fix markups [ci skip] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67337 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- enum.c | 51 +++++++++++++++++++++++++-------------------------- 1 file changed, 25 insertions(+), 26 deletions(-) (limited to 'enum.c') 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 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. + * 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 sort 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 File + * This sort is inefficient: it generates two new File * objects during every comparison. A slightly better technique is to - * use the Kernel#test 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 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. + * 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 sort_by 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 Comparable; + * first form assumes all objects implement Comparable; * the second uses the block to return a <=> b. * * 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 Comparable; + * first form assumes all objects implement Comparable; * the second uses the block to return a <=> b. * * 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 Comparable; the second uses the + * objects implement Comparable; the second uses the * block to return a <=> b. * * a = %w(albatross dog horse) @@ -4070,14 +4070,13 @@ enum_uniq(VALUE obj) } /* - * 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 <=> 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 <=> operator, as these methods rely on an + * ordering between members of the collection. */ void -- cgit v1.2.1