From 8a6111d2f0d133c3a461b4b07be942ea1d207eec Mon Sep 17 00:00:00 2001 From: Utkarsh Kukreti Date: Sun, 22 May 2011 04:32:26 +0530 Subject: [PATCH] Improve documentation of Hash#key. --- hash.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) diff --git a/hash.c b/hash.c index 8a3e8fe..bf240d7 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 * */ -- 1.7.4.1