diff --git a/hash.c b/hash.c index f1b3aca929..b959747206 100644 --- a/hash.c +++ b/hash.c @@ -2090,16 +2090,19 @@ rb_hash_stlike_lookup(VALUE hash, st_data_t key, st_data_t *pval) /* * call-seq: - * hash[key] -> value + * self[key] -> object * - * Returns the value associated with the given +key+, if found: - * h = {foo: 0, bar: 1, baz: 2} - * h[:foo] # => 0 + * Searches for a hash key equivalent to the given +key+; + * see {Hash Key Equivalence}[rdoc-ref:Hash@Hash+Key+Equivalence]. * - * If +key+ is not found, returns a default value - * (see {Hash Default}[rdoc-ref:Hash@Hash+Default]): - * h = {foo: 0, bar: 1, baz: 2} - * h[:nosuch] # => nil + * If the key is found, returns its value: + * + * {foo: 0, bar: 1, baz: 2} + * h[:bar] # => 1 + * + * Otherwise, returns a default value (see {Hash Default}[rdoc-ref:Hash@Hash+Default]). + * + * Related: #[]=; see also {Methods for Fetching}[rdoc-ref:Hash@Methods+for+Fetching]. */ VALUE