doc/atomic-rdoc/classes/Enumerable.src/M000333.html in facets-0.7.1 vs doc/atomic-rdoc/classes/Enumerable.src/M000333.html in facets-0.7.2

- old
+ new

@@ -3,29 +3,21 @@ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> - <title>every (Enumerable)</title> + <title>partition_by (Enumerable)</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/enumerable/every.rb, line 30</span> - <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">every</span> - <span class="ruby-comment cmt">#Functor.new(self) do |op,*args|</span> - <span class="ruby-constant">Functor</span>.<span class="ruby-identifier">new</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">op</span>,<span class="ruby-operator">*</span><span class="ruby-identifier">args</span><span class="ruby-operator">|</span> - <span class="ruby-identifier">a</span> = <span class="ruby-identifier">args</span>.<span class="ruby-identifier">collect</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">arg</span><span class="ruby-operator">|</span> - <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">arg</span>.<span class="ruby-identifier">kind_of?</span>(<span class="ruby-constant">Enumerable</span>) - <span class="ruby-identifier">ln</span> = ( <span class="ruby-identifier">arg</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">length</span> <span class="ruby-value">? </span><span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">arg</span>.<span class="ruby-identifier">length</span> ) - <span class="ruby-keyword kw">self</span>[<span class="ruby-value">0</span><span class="ruby-operator">...</span><span class="ruby-identifier">ln</span>].<span class="ruby-identifier">zip</span>(<span class="ruby-identifier">arg</span>[<span class="ruby-value">0</span><span class="ruby-operator">...</span><span class="ruby-identifier">ln</span>]).<span class="ruby-identifier">collect</span>{ <span class="ruby-operator">|</span><span class="ruby-identifier">a</span>,<span class="ruby-identifier">b</span><span class="ruby-operator">|</span> <span class="ruby-identifier">a</span>.<span class="ruby-identifier">send</span>(<span class="ruby-identifier">op</span>,<span class="ruby-identifier">b</span>) } - <span class="ruby-comment cmt">#self[0...l].zip(arg[0...1]).collect{ |a,b| b ? a.send(op,b) : nil }</span> - <span class="ruby-keyword kw">else</span> - <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">collect</span>{ <span class="ruby-operator">|</span><span class="ruby-identifier">a</span><span class="ruby-operator">|</span> <span class="ruby-identifier">a</span>.<span class="ruby-identifier">send</span>(<span class="ruby-identifier">op</span>,<span class="ruby-identifier">arg</span>) } - <span class="ruby-keyword kw">end</span> - <span class="ruby-keyword kw">end</span> - <span class="ruby-identifier">a</span>.<span class="ruby-identifier">flatten!</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">args</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">==</span> <span class="ruby-value">1</span> - <span class="ruby-identifier">a</span> + <pre><span class="ruby-comment cmt"># File lib/facet/enumerable/partition_by.rb, line 19</span> + <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">partition_by</span> + <span class="ruby-identifier">result</span> = {} + <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">e</span><span class="ruby-operator">|</span> + <span class="ruby-identifier">value</span> = <span class="ruby-keyword kw">yield</span> <span class="ruby-identifier">e</span> + (<span class="ruby-identifier">result</span>[<span class="ruby-identifier">value</span>] <span class="ruby-operator">||=</span> []) <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">e</span> <span class="ruby-keyword kw">end</span> + <span class="ruby-identifier">result</span> <span class="ruby-keyword kw">end</span></pre> </body> </html> \ No newline at end of file