doc/rdoc/classes/RFuzz/PushBackIO.src/M000015.html in rfuzz-0.8 vs doc/rdoc/classes/RFuzz/PushBackIO.src/M000015.html in rfuzz-0.9

- old
+ new

@@ -3,16 +3,43 @@ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> - <title>flush (RFuzz::PushBackIO)</title> + <title>read (RFuzz::PushBackIO)</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/rfuzz/pushbackio.rb, line 70</span> -70: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">flush</span> -71: <span class="ruby-identifier">protect</span> { <span class="ruby-ivar">@secondary</span>.<span class="ruby-identifier">flush</span> } -72: <span class="ruby-keyword kw">end</span></pre> + <pre> <span class="ruby-comment cmt"># File lib/rfuzz/pushbackio.rb, line 51</span> +51: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">read</span>(<span class="ruby-identifier">n</span>, <span class="ruby-identifier">partial</span>=<span class="ruby-keyword kw">false</span>) +52: <span class="ruby-identifier">random_death</span> +53: <span class="ruby-identifier">r</span> = <span class="ruby-identifier">pop</span>(<span class="ruby-identifier">n</span>) +54: <span class="ruby-identifier">needs</span> = <span class="ruby-identifier">n</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">r</span>.<span class="ruby-identifier">length</span> +55: +56: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">needs</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">0</span> +57: <span class="ruby-identifier">sec</span> = <span class="ruby-value str">&quot;&quot;</span> +58: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">partial</span> +59: <span class="ruby-keyword kw">begin</span> +60: <span class="ruby-identifier">protect</span> <span class="ruby-keyword kw">do</span> +61: <span class="ruby-identifier">sec</span> = <span class="ruby-ivar">@secondary</span>.<span class="ruby-identifier">readpartial</span>(<span class="ruby-identifier">needs</span>) +62: <span class="ruby-keyword kw">end</span> +63: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">EOFError</span> +64: <span class="ruby-identifier">close</span> +65: <span class="ruby-keyword kw">end</span> +66: <span class="ruby-keyword kw">else</span> +67: <span class="ruby-identifier">protect</span> { <span class="ruby-identifier">sec</span> = <span class="ruby-ivar">@secondary</span>.<span class="ruby-identifier">read</span>(<span class="ruby-identifier">needs</span>)} +68: <span class="ruby-keyword kw">end</span> +69: +70: <span class="ruby-identifier">r</span> <span class="ruby-operator">&lt;&lt;</span> (<span class="ruby-identifier">sec</span> <span class="ruby-operator">||</span> <span class="ruby-value str">&quot;&quot;</span>) +71: +72: <span class="ruby-comment cmt"># finally, if there's nothing at all returned then this is bad</span> +73: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">r</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span> +74: <span class="ruby-identifier">raise</span> <span class="ruby-constant">HttpClientError</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">&quot;Server returned empty response.&quot;</span>) +75: <span class="ruby-keyword kw">end</span> +76: <span class="ruby-keyword kw">end</span> +77: +78: <span class="ruby-identifier">reset</span> +79: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">r</span> +80: <span class="ruby-keyword kw">end</span></pre> </body> </html> \ No newline at end of file