diff options
author | yugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-07-22 07:46:37 +0000 |
---|---|---|
committer | yugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-07-22 07:46:37 +0000 |
commit | e1f50e25647e18aa4894f19f1abb6cb8ded1113c (patch) | |
tree | 6b0225deae68798a97ffe496eccafda2ff1978b9 | |
parent | 681dce6bfefc2f4cb4adedce884e91d97e50b321 (diff) | |
download | ruby-e1f50e25647e18aa4894f19f1abb6cb8ded1113c.tar.gz |
* hash.c (Hash::[]): rdoc. patch by Marc-Andre Lafortune.
#1385.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24236 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | hash.c | 18 |
2 files changed, 16 insertions, 7 deletions
@@ -1,3 +1,8 @@ +Wed Jul 22 16:38:39 2009 Yuki Sonoda (Yugui) <yugui@yugui.jp> + + * hash.c (Hash::[]): rdoc. patch by Marc-Andre Lafortune. + #1385. + Wed Jul 22 10:00:53 2009 NAKAMURA Usaku <usa@ruby-lang.org> * win32/win32.c (WSABUF): get rid of compile error on VC9 and mingw. @@ -326,15 +326,19 @@ rb_hash_initialize(int argc, VALUE *argv, VALUE hash) /* * call-seq: - * Hash[ [key =>|, value]* ] => hash + * Hash[ key, value, ... ] => hash + * Hash[ [ [key, value], ... ] ] => hash + * Hash[ object ] => hash * * Creates a new hash populated with the given objects. Equivalent to - * the literal <code>{ <i>key</i>, <i>value</i>, ... }</code>. Keys and - * values occur in pairs, so there must be an even number of arguments. - * - * Hash["a", 100, "b", 200] #=> {"a"=>100, "b"=>200} - * Hash["a" => 100, "b" => 200] #=> {"a"=>100, "b"=>200} - * { "a" => 100, "b" => 200 } #=> {"a"=>100, "b"=>200} + * the literal <code>{ <i>key</i> => <i>value</i>, ... }</code>. In the first + * form, keys and values occur in pairs, so there must be an even number of arguments. + * The second and third form take a single argument which is either + * an array of key-value pairs or an object convertible to a hash. + * + * Hash["a", 100, "b", 200] #=> {"a"=>100, "b"=>200} + * Hash[ [ ["a", 100], ["b", 200] ] ] #=> {"a"=>100, "b"=>200} + * Hash["a" => 100, "b" => 200] #=> {"a"=>100, "b"=>200} */ static VALUE |