[前][次][番号順一覧][スレッド一覧]

ruby-changes:42851

From: nobu <ko1@a...>
Date: Fri, 6 May 2016 07:19:57 +0900 (JST)
Subject: [ruby-changes:42851] nobu:r54925 (trunk): enum.c: examples of Enumerable#detect [ci skip]

nobu	2016-05-06 08:16:28 +0900 (Fri, 06 May 2016)

  New Revision: 54925

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=54925

  Log:
    enum.c: examples of Enumerable#detect [ci skip]
    
    * enum.c (enum_find): [DOC] add more examples to the documentation
      of Enumerable#detect, to show that it equals to Enumerable#find.
      [Fix GH-1340]

  Modified files:
    trunk/ChangeLog
    trunk/enum.c
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 54924)
+++ ChangeLog	(revision 54925)
@@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Fri May  6 08:16:26 2016  David Silva  <david.silva@d...>
+
+	* enum.c (enum_find): [DOC] add more examples to the documentation
+	  of Enumerable#detect, to show that it equals to Enumerable#find.
+	  [Fix GH-1340]
+
 Thu May  5 18:08:31 2016  Yuichiro Kaneko  <yui-knk@r...>
 
 	* test/ruby/test_complexrational.rb: Remove duplicated raise.
Index: enum.c
===================================================================
--- enum.c	(revision 54924)
+++ enum.c	(revision 54925)
@@ -225,7 +225,12 @@ find_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, mem https://github.com/ruby/ruby/blob/trunk/enum.c#L225
  *
  *  If no block is given, an enumerator is returned instead.
  *
+ *     (1..100).detect  => #<Enumerator: 1..100:detect>
+ *     (1..100).find    => #<Enumerator: 1..100:find>
+ *
  *     (1..10).detect	{ |i| i % 5 == 0 and i % 7 == 0 }   #=> nil
+ *     (1..10).find	{ |i| i % 5 == 0 and i % 7 == 0 }   #=> nil
+ *     (1..100).detect	{ |i| i % 5 == 0 and i % 7 == 0 }   #=> 35
  *     (1..100).find	{ |i| i % 5 == 0 and i % 7 == 0 }   #=> 35
  *
  */

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]