diff --git a/ChangeLog b/ChangeLog index 603f68fe42..21751ede62 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Mon May 23 08:35:24 2011 Eric Hodel + + * 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 * enumerator.c: Improve documentation. Patch by Dave Copeland. diff --git a/hash.c b/hash.c index 8a3e8fe44f..bf240d7082 100644 --- a/hash.c +++ b/hash.c @@ -740,10 +740,12 @@ key_i(VALUE key, VALUE value, VALUE arg) * call-seq: * hsh.key(value) -> key * - * Returns the key for a given value. If not found, returns nil. + * Returns the key of the first occurrence of a given value. If the value is + * not found, returns nil. * - * 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 * */