1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* hash.c (doc): doc fix, patch by Run Paint Run Run [ruby-core:23644]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25079 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
marcandre 2009-09-24 18:36:52 +00:00
parent e6f4473316
commit fc01d42600

12
hash.c
View file

@ -466,7 +466,7 @@ rb_hash_rehash(VALUE hash)
* hsh[key] => value * hsh[key] => value
* *
* Element Reference---Retrieves the <i>value</i> object corresponding * Element Reference---Retrieves the <i>value</i> object corresponding
* to the <i>key</i> object. If not found, returns the a default value (see * to the <i>key</i> object. If not found, returns the default value (see
* <code>Hash::new</code> for details). * <code>Hash::new</code> for details).
* *
* h = { "a" => 100, "b" => 200 } * h = { "a" => 100, "b" => 200 }
@ -600,7 +600,7 @@ rb_hash_default(int argc, VALUE *argv, VALUE hash)
* hsh.default = obj => obj * hsh.default = obj => obj
* *
* Sets the default value, the value returned for a key that does not * Sets the default value, the value returned for a key that does not
* exist in the hash. It is not possible to set the a default to a * exist in the hash. It is not possible to set the default to a
* <code>Proc</code> that will be executed on each key lookup. * <code>Proc</code> that will be executed on each key lookup.
* *
* h = { "a" => 100, "b" => 200 } * h = { "a" => 100, "b" => 200 }
@ -947,7 +947,7 @@ select_i(VALUE key, VALUE value, VALUE result)
* call-seq: * call-seq:
* hsh.select {|key, value| block} => a_hash * hsh.select {|key, value| block} => a_hash
* *
* Returns a new hash consisting of entries which the block returns true. * Returns a new hash consisting of entries for which the block returns true.
* *
* h = { "a" => 100, "b" => 200, "c" => 300 } * h = { "a" => 100, "b" => 200, "c" => 300 }
* h.select {|k,v| k > "a"} #=> {"b" => 200, "c" => 300} * h.select {|k,v| k > "a"} #=> {"b" => 200, "c" => 300}
@ -1743,7 +1743,7 @@ rassoc_i(VALUE key, VALUE val, VALUE arg)
* hash.rassoc(key) -> an_array or nil * hash.rassoc(key) -> an_array or nil
* *
* Searches through the hash comparing _obj_ with the value using <code>==</code>. * Searches through the hash comparing _obj_ with the value using <code>==</code>.
* Returns the first key-value pair (two elements array) that matches. See * Returns the first key-value pair (two-element array) that matches. See
* also <code>Array#rassoc</code>. * also <code>Array#rassoc</code>.
* *
* a = {1=> "one", 2 => "two", 3 => "three", "ii" => "two"} * a = {1=> "one", 2 => "two", 3 => "three", "ii" => "two"}
@ -1770,7 +1770,7 @@ rb_hash_rassoc(VALUE hash, VALUE obj)
* Returns a new array that is a one-dimensional flattening of this * Returns a new array that is a one-dimensional flattening of this
* hash. That is, for every key or value that is an array, extract * hash. That is, for every key or value that is an array, extract
* its elements into the new array. Unlike Array#flatten, this * its elements into the new array. Unlike Array#flatten, this
* method does not flatten recursively by default. If the optional * method does not flatten recursively by default. The optional
* <i>level</i> argument determines the level of recursion to flatten. * <i>level</i> argument determines the level of recursion to flatten.
* *
* a = {1=> "one", 2 => [2,"two"], 3 => "three"} * a = {1=> "one", 2 => [2,"two"], 3 => "three"}
@ -1797,7 +1797,7 @@ rb_hash_flatten(int argc, VALUE *argv, VALUE hash)
* call-seq: * call-seq:
* hsh.compare_by_identity => hsh * hsh.compare_by_identity => hsh
* *
* Makes <i>hsh</i> to compare its keys by their identity, i.e. it * Makes <i>hsh</i> compare its keys by their identity, i.e. it
* will consider exact same objects as same keys. * will consider exact same objects as same keys.
* *
* h1 = { "a" => 100, "b" => 200, :c => "c" } * h1 = { "a" => 100, "b" => 200, :c => "c" }