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

ruby-changes:19660

From: drbrain <ko1@a...>
Date: Mon, 23 May 2011 08:37:09 +0900 (JST)
Subject: [ruby-changes:19660] drbrain:r31705 (trunk): * hash.c: Improve documentation of Hash#key. Patch by Utkarsh

drbrain	2011-05-23 08:37:03 +0900 (Mon, 23 May 2011)

  New Revision: 31705

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=31705

  Log:
    * hash.c:  Improve documentation of Hash#key.  Patch by Utkarsh
      Kukreti.  [Ruby 1.9 - Bug #4760]

  Modified files:
    trunk/ChangeLog
    trunk/hash.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 31704)
+++ ChangeLog	(revision 31705)
@@ -1,3 +1,8 @@
+Mon May 23 08:35:24 2011  Eric Hodel  <drbrain@s...>
+
+	* hash.c:  Improve documentation of Hash#key.  Patch by Utkarsh
+	  Kukreti.  [Ruby 1.9 - Bug #4760]
+
 Mon May 23 08:32:59 2011  Eric Hodel  <drbrain@s...>
 
 	* enumerator.c:  Improve documentation.  Patch by Dave Copeland.
Index: hash.c
===================================================================
--- hash.c	(revision 31704)
+++ hash.c	(revision 31705)
@@ -740,10 +740,12 @@
  *  call-seq:
  *     hsh.key(value)    -> key
  *
- *  Returns the key for a given value. If not found, returns <code>nil</code>.
+ *  Returns the key of the first occurrence of a given value. If the value is
+ *  not found, returns <code>nil</code>.
  *
- *     h = { "a" => 100, "b" => 200 }
+ *     h = { "a" => 100, "b" => 200, "c" => 300, "d" => 300 }
  *     h.key(200)   #=> "b"
+ *     h.key(300)   #=> "c"
  *     h.key(999)   #=> nil
  *
  */

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

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