ruby-changes:18405
From: akr <ko1@a...>
Date: Thu, 30 Dec 2010 11:58:47 +0900 (JST)
Subject: [ruby-changes:18405] Ruby:r30428 (trunk): update doc.
akr 2010-12-30 11:58:42 +0900 (Thu, 30 Dec 2010) New Revision: 30428 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=30428 Log: update doc. Modified files: trunk/enum.c Index: enum.c =================================================================== --- enum.c (revision 30427) +++ enum.c (revision 30428) @@ -616,7 +616,7 @@ * * If no block is given, an enumerator is returned instead. * - * (1..6).partition {|i| (i&1).zero?} #=> [[2, 4, 6], [1, 3, 5]] + * (1..6).partition {|v| v.even? } #=> [[2, 4, 6], [1, 3, 5]] * */ @@ -714,6 +714,11 @@ * If the enumerable is empty, the first form returns <code>nil</code>, and the * second form returns an empty array. * + * %w[foo bar baz].first #=> "foo" + * %w[foo bar baz].first(2) #=> ["foo", "bar"] + * %w[foo bar baz].first(10) #=> ["foo", "bar", "baz"] + * [].first #=> nil + * */ static VALUE @@ -1627,6 +1632,13 @@ * * If no block is given, an enumerator is returned instead. * + * (1..3).reverse_each {|v| p v } + * + * produces: + * + * 3 + * 2 + * 1 */ static VALUE @@ -1671,13 +1683,17 @@ * def each * yield 1 * yield 1,2 + * yield * end * end - * Foo.new.each_entry{|o| print o, " -- "} + * Foo.new.each_entry{|o| p o } * * produces: * - * 1 -- [1, 2] -- + * 1 + * [1, 2] + * nil + * */ static VALUE -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/