Skip to content

Commit

Permalink
enum.c: examples of Enumerable#detect [ci skip]
Browse files Browse the repository at this point in the history
* 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]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54925 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information
nobu committed May 5, 2016
1 parent d6c3079 commit 0c13d23
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
6 changes: 6 additions & 0 deletions ChangeLog
@@ -1,3 +1,9 @@
Fri May 6 08:16:26 2016 David Silva <david.silva@digital.cabinet-office.gov.uk>

* 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@ruby-lang.org>

* test/ruby/test_complexrational.rb: Remove duplicated raise.
Expand Down
5 changes: 5 additions & 0 deletions enum.c
Expand Up @@ -225,7 +225,12 @@ find_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, memop))
*
* 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
*
*/
Expand Down

0 comments on commit 0c13d23

Please sign in to comment.