doc/atomic-rdoc/classes/Array.src/M000058.html in facets-0.7.1 vs doc/atomic-rdoc/classes/Array.src/M000058.html in facets-0.7.2
- old
+ new
@@ -3,21 +3,22 @@
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
- <title>at_rand (Array)</title>
+ <title>thru (Array)</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
</head>
<body class="standalone-code">
- <pre><span class="ruby-comment cmt"># File lib/facet/array/at_rand.rb, line 22</span>
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">at_rand</span>( <span class="ruby-identifier">number</span>=<span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">exclusive</span>=<span class="ruby-keyword kw">true</span> )
- <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">number</span>
- <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">at</span>( <span class="ruby-identifier">rand_index</span> )
- <span class="ruby-keyword kw">else</span>
- <span class="ruby-identifier">number</span> = <span class="ruby-identifier">number</span>.<span class="ruby-identifier">to_int</span>
- <span class="ruby-identifier">values_at</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">rand_index</span>(<span class="ruby-identifier">number</span>,<span class="ruby-identifier">exclusive</span>))
+ <pre><span class="ruby-comment cmt"># File lib/facet/array/thru.rb, line 9</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">thru</span>( <span class="ruby-identifier">from</span>, <span class="ruby-identifier">to</span> )
+ <span class="ruby-identifier">a</span> = []
+ <span class="ruby-identifier">i</span> = <span class="ruby-identifier">from</span>
+ <span class="ruby-keyword kw">while</span> <span class="ruby-identifier">i</span> <span class="ruby-operator"><=</span> <span class="ruby-identifier">to</span>
+ <span class="ruby-identifier">a</span> <span class="ruby-operator"><<</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">at</span>(<span class="ruby-identifier">i</span>)
+ <span class="ruby-identifier">i</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span>
<span class="ruby-keyword kw">end</span>
+ <span class="ruby-identifier">a</span>
<span class="ruby-keyword kw">end</span></pre>
</body>
</html>
\ No newline at end of file