Project

General

Profile

Bug #1385 ยป doc_hash.patch

marcandre (Marc-Andre Lafortune), 06/20/2009 08:51 PM

View differences:

hash.c (working copy)
326 326

  
327 327
/*
328 328
 *  call-seq:
329
 *     Hash[ [key =>|, value]* ]   => hash
329
 *     Hash[ key, value, ... ]   => hash
330
 *     Hash[ [ [key, value], ... ] ]   => hash
331
 *     Hash[ object ]   => hash
330 332
 *
331 333
 *  Creates a new hash populated with the given objects. Equivalent to
332
 *  the literal <code>{ <i>key</i>, <i>value</i>, ... }</code>. Keys and
333
 *  values occur in pairs, so there must be an even number of arguments.
334
 *  the literal <code>{ <i>key</i> => <i>value</i>, ... }</code>. In the first
335
 *  form, keys and values occur in pairs, so there must be an even number of arguments.
336
 *  The second and third form take a single argument which is either
337
 *  an array of key-value pairs or an object convertible to a hash.
334 338
 *
335
 *     Hash["a", 100, "b", 200]       #=> {"a"=>100, "b"=>200}
336
 *     Hash["a" => 100, "b" => 200]   #=> {"a"=>100, "b"=>200}
337
 *     { "a" => 100, "b" => 200 }     #=> {"a"=>100, "b"=>200}
339
 *     Hash["a", 100, "b", 200]             #=> {"a"=>100, "b"=>200}
340
 *     Hash[ [ ["a", 100], ["b", 200] ] ]   #=> {"a"=>100, "b"=>200}
341
 *     Hash["a" => 100, "b" => 200]         #=> {"a"=>100, "b"=>200}
338 342
 */
339 343

  
340 344
static VALUE