https://redmine.ruby-lang.org/https://redmine.ruby-lang.org/favicon.ico?17113305112009-04-17T14:00:14ZRuby Issue Tracking SystemRuby master - Bug #1385: Wonderful undocumented feature in Ruby 1.8.7 & 1.9https://redmine.ruby-lang.org/issues/1385?journal_id=37672009-04-17T14:00:14Zmarcandre (Marc-Andre Lafortune)marcandre-ruby-core@marc-andre.ca
<ul></ul><p>=begin<br>
As pointed out by Joel VanderWerf, my second usage example is wrong (it takes commas instead of =>). It should read:</p>
<p>/*</p>
<ul>
<li>call-seq:</li>
<li>
<pre><code>Hash[ key, value, ... ] => hash
</code></pre>
</li>
<li>
<pre><code>Hash[ [ [key, value], ... ] ] => hash
</code></pre>
</li>
<li>
<pre><code>Hash[ object ] => hash
</code></pre>
</li>
<li>
<li>Creates a new hash populated with the given objects. Equivalent to</li>
<li>the literal <code>{ <i>key</i> => <i>value</i>, ... }</code>. In the first</li>
<li>form, keys and values occur in pairs, so there must be an even number of arguments.</li>
<li>The second and third form take a single argument which is either</li>
<li>an array of key-value pairs or an object convertible to a hash.</li>
<li>
<li>
<pre><code>Hash["a", 100, "b", 200] #=> {"a"=>100, "b"=>200}
</code></pre>
</li>
<li>
<pre><code>Hash[ [ ["a", 100], ["b", 200] ] ] #=> {"a"=>100, "b"=>200}
</code></pre>
</li>
<li>
<pre><code>Hash["a" => 100, "b" => 200] #=> {"a"=>100, "b"=>200}
</code></pre>
</li>
<li>
<pre><code>{"a" => 100, "b" => 200} #=> {"a"=>100, "b"=>200}
</code></pre>
</li>
</ul>
<p>*/</p>
<p>Sorry!</p>
<p>=end</p> Ruby master - Bug #1385: Wonderful undocumented feature in Ruby 1.8.7 & 1.9https://redmine.ruby-lang.org/issues/1385?journal_id=40542009-05-24T05:48:04Zmarcandre (Marc-Andre Lafortune)marcandre-ruby-core@marc-andre.ca
<ul></ul><p>=begin<br>
This feature has been confirmed by Matz in ruby-core #23433, so this ticket can be closed after the change to the documentation has been applied. Thanks!<br>
=end</p> Ruby master - Bug #1385: Wonderful undocumented feature in Ruby 1.8.7 & 1.9https://redmine.ruby-lang.org/issues/1385?journal_id=43492009-06-20T20:51:48Zmarcandre (Marc-Andre Lafortune)marcandre-ruby-core@marc-andre.ca
<ul><li><strong>File</strong> <a href="/attachments/427">doc_hash.patch</a> <a class="icon-only icon-download" title="Download" href="/attachments/download/427/doc_hash.patch">doc_hash.patch</a> added</li></ul><p>=begin<br>
The included patch completes the documentation for Hash.[], including the form Hash[[[:a,1],[:b,2]]]<br>
=end</p> Ruby master - Bug #1385: Wonderful undocumented feature in Ruby 1.8.7 & 1.9https://redmine.ruby-lang.org/issues/1385?journal_id=47692009-07-16T16:31:26Zyugui (Yuki Sonoda)yugui@yugui.jp
<ul><li><strong>Assignee</strong> set to <i>yugui (Yuki Sonoda)</i></li></ul><p>=begin</p>
<p>=end</p> Ruby master - Bug #1385: Wonderful undocumented feature in Ruby 1.8.7 & 1.9https://redmine.ruby-lang.org/issues/1385?journal_id=49052009-07-22T16:47:06Zyugui (Yuki Sonoda)yugui@yugui.jp
<ul><li><strong>Status</strong> changed from <i>Open</i> to <i>Closed</i></li><li><strong>% Done</strong> changed from <i>0</i> to <i>100</i></li></ul><p>=begin<br>
Applied in changeset r24236.<br>
=end</p>