doc/Safubot/Twitter/Bot.html in safubot-0.0.3 vs doc/Safubot/Twitter/Bot.html in safubot-0.0.4

- old
+ new

@@ -382,12 +382,11 @@ <span class="summary_desc"><div class='inline'><p> -Options are passed straight through to ::TweetStream and ::Twitter, but the -:username is ours and important. +::Twitter, but the :username is ours and important. </p> </div></span> </li> @@ -584,41 +583,63 @@ </p><div class="docstring"> <div class="discussion"> <p> -Options are passed straight through to ::TweetStream and ::Twitter, but the -:username is ours and important. +::Twitter, but the :username is ours and important. </p> </div> </div> <div class="tags"> + <h3>Parameters:</h3> +<ul class="param"> + <li> + + <span class='name'>options</span> + + + <span class='type'></span> + + + <em class="default">(defaults to: <tt>{}</tt>)</em> + + + &mdash; + <div class='inline'><p> +These are passed straight through to ::TweetStream and +</p> +</div> + + </li> + +</ul> + </div><table class="source_code"> <tr> <td> <pre class="lines"> -283 -284 -285 -286 -287 -288 -289 -290 -291 -292 -293 -294</pre> +299 +300 +301 +302 +303 +304 +305 +306 +307 +308 +309 +310</pre> </td> <td> - <pre class="code"><span class="info file"># File 'lib/safubot/twitter.rb', line 283</span> + <pre class="code"><span class="info file"># File 'lib/safubot/twitter.rb', line 299</span> <span class='kw'>def</span> <span class='id initialize'>initialize</span><span class='lparen'>(</span><span class='id options'>options</span><span class='op'>=</span><span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span> <span class='id defaults'>defaults</span> <span class='op'>=</span> <span class='lbrace'>{</span> <span class='symbol'>:username</span> <span class='op'>=&gt;</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='symbol'>:consumer_key</span> <span class='op'>=&gt;</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='symbol'>:consumer_secret</span> <span class='op'>=&gt;</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='symbol'>:oauth_token</span> <span class='op'>=&gt;</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='symbol'>:oauth_token_secret</span> <span class='op'>=&gt;</span> <span class='kw'>nil</span><span class='comma'>,</span> @@ -666,16 +687,16 @@ <tr> <td> <pre class="lines"> -160 -161 -162</pre> +163 +164 +165</pre> </td> <td> - <pre class="code"><span class="info file"># File 'lib/safubot/twitter.rb', line 160</span> + <pre class="code"><span class="info file"># File 'lib/safubot/twitter.rb', line 163</span> <span class='kw'>def</span> <span class='id client'>client</span> <span class='ivar'>@client</span> <span class='kw'>end</span></pre> </td> @@ -709,16 +730,16 @@ <tr> <td> <pre class="lines"> -160 -161 -162</pre> +163 +164 +165</pre> </td> <td> - <pre class="code"><span class="info file"># File 'lib/safubot/twitter.rb', line 160</span> + <pre class="code"><span class="info file"># File 'lib/safubot/twitter.rb', line 163</span> <span class='kw'>def</span> <span class='id opts'>opts</span> <span class='ivar'>@opts</span> <span class='kw'>end</span></pre> </td> @@ -752,16 +773,16 @@ <tr> <td> <pre class="lines"> -160 -161 -162</pre> +163 +164 +165</pre> </td> <td> - <pre class="code"><span class="info file"># File 'lib/safubot/twitter.rb', line 160</span> + <pre class="code"><span class="info file"># File 'lib/safubot/twitter.rb', line 163</span> <span class='kw'>def</span> <span class='id pid'>pid</span> <span class='ivar'>@pid</span> <span class='kw'>end</span></pre> </td> @@ -795,16 +816,16 @@ <tr> <td> <pre class="lines"> -160 -161 -162</pre> +163 +164 +165</pre> </td> <td> - <pre class="code"><span class="info file"># File 'lib/safubot/twitter.rb', line 160</span> + <pre class="code"><span class="info file"># File 'lib/safubot/twitter.rb', line 163</span> <span class='kw'>def</span> <span class='id stream'>stream</span> <span class='ivar'>@stream</span> <span class='kw'>end</span></pre> </td> @@ -838,16 +859,16 @@ <tr> <td> <pre class="lines"> -160 -161 -162</pre> +163 +164 +165</pre> </td> <td> - <pre class="code"><span class="info file"># File 'lib/safubot/twitter.rb', line 160</span> + <pre class="code"><span class="info file"># File 'lib/safubot/twitter.rb', line 163</span> <span class='kw'>def</span> <span class='id username'>username</span> <span class='ivar'>@username</span> <span class='kw'>end</span></pre> </td> @@ -877,29 +898,50 @@ </div> </div> <div class="tags"> + <h3>Parameters:</h3> +<ul class="param"> + <li> + + <span class='name'>message</span> + + + <span class='type'></span> + + + + &mdash; + <div class='inline'><p> +A raw JSON-derived direct message. +</p> +</div> + + </li> + +</ul> + </div><table class="source_code"> <tr> <td> <pre class="lines"> -180 -181 -182 -183</pre> +189 +190 +191 +192</pre> </td> <td> - <pre class="code"><span class="info file"># File 'lib/safubot/twitter.rb', line 180</span> + <pre class="code"><span class="info file"># File 'lib/safubot/twitter.rb', line 189</span> <span class='kw'>def</span> <span class='id handle_message'>handle_message</span><span class='lparen'>(</span><span class='id message'>message</span><span class='rparen'>)</span> <span class='kw'>return</span> <span class='kw'>if</span> <span class='id message'>message</span><span class='period'>.</span><span class='id sender'>sender</span><span class='period'>.</span><span class='id screen_name'>screen_name</span> <span class='op'>==</span> <span class='ivar'>@username</span> - <span class='const'>DirectMessage</span><span class='period'>.</span><span class='id from'>from</span><span class='lparen'>(</span><span class='id message'>message</span><span class='rparen'>)</span><span class='period'>.</span><span class='id make_request'>make_request</span> + <span class='id handle_request'>handle_request</span><span class='lparen'>(</span><span class='const'>DirectMessage</span><span class='period'>.</span><span class='id from'>from</span><span class='lparen'>(</span><span class='id message'>message</span><span class='rparen'>)</span><span class='period'>.</span><span class='id make_request'>make_request</span><span class='rparen'>)</span> <span class='kw'>end</span></pre> </td> </tr> </table> </div> @@ -919,24 +961,45 @@ </div> </div> <div class="tags"> + <h3>Parameters:</h3> +<ul class="param"> + <li> + + <span class='name'>req</span> + + + <span class='type'></span> + + + + &mdash; + <div class='inline'><p> +Request to handle. +</p> +</div> + + </li> + +</ul> + </div><table class="source_code"> <tr> <td> <pre class="lines"> -175 -176 -177</pre> +182 +183 +184</pre> </td> <td> - <pre class="code"><span class="info file"># File 'lib/safubot/twitter.rb', line 175</span> + <pre class="code"><span class="info file"># File 'lib/safubot/twitter.rb', line 182</span> <span class='kw'>def</span> <span class='id handle_request'>handle_request</span><span class='lparen'>(</span><span class='id req'>req</span><span class='rparen'>)</span> <span class='id emit'>emit</span><span class='lparen'>(</span><span class='symbol'>:request</span><span class='comma'>,</span> <span class='id req'>req</span><span class='rparen'>)</span> <span class='kw'>unless</span> <span class='id req'>req</span><span class='period'>.</span><span class='id nil?'>nil?</span> <span class='op'>||</span> <span class='id req'>req</span><span class='period'>.</span><span class='id processed'>processed</span> <span class='kw'>end</span></pre> </td> @@ -960,34 +1023,55 @@ </div> </div> <div class="tags"> + <h3>Parameters:</h3> +<ul class="param"> + <li> + + <span class='name'>status</span> + + + <span class='type'></span> + + + + &mdash; + <div class='inline'><p> +A raw JSON-derived tweet. +</p> +</div> + + </li> + +</ul> + </div><table class="source_code"> <tr> <td> <pre class="lines"> -187 -188 -189 -190 -191 -192 -193 -194</pre> +198 +199 +200 +201 +202 +203 +204 +205</pre> </td> <td> - <pre class="code"><span class="info file"># File 'lib/safubot/twitter.rb', line 187</span> + <pre class="code"><span class="info file"># File 'lib/safubot/twitter.rb', line 198</span> <span class='kw'>def</span> <span class='id handle_tweet'>handle_tweet</span><span class='lparen'>(</span><span class='id status'>status</span><span class='rparen'>)</span> <span class='kw'>return</span> <span class='kw'>if</span> <span class='id status'>status</span><span class='period'>.</span><span class='id user'>user</span><span class='period'>.</span><span class='id screen_name'>screen_name</span> <span class='op'>==</span> <span class='ivar'>@username</span> <span class='kw'>if</span> <span class='id status'>status</span><span class='period'>.</span><span class='id text'>text</span><span class='period'>.</span><span class='id match'>match</span><span class='lparen'>(</span><span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>@</span><span class='embexpr_beg'>#{</span><span class='ivar'>@username</span><span class='rbrace'>}</span><span class='regexp_end'>/i</span></span><span class='rparen'>)</span> - <span class='const'>Tweet</span><span class='period'>.</span><span class='id from'>from</span><span class='lparen'>(</span><span class='id status'>status</span><span class='rparen'>)</span><span class='period'>.</span><span class='id make_request'>make_request</span> + <span class='id handle_request'>handle_request</span><span class='lparen'>(</span><span class='const'>Tweet</span><span class='period'>.</span><span class='id from'>from</span><span class='lparen'>(</span><span class='id status'>status</span><span class='rparen'>)</span><span class='period'>.</span><span class='id make_request'>make_request</span><span class='rparen'>)</span> <span class='kw'>else</span> <span class='id emit'>emit</span><span class='lparen'>(</span><span class='symbol'>:timeline</span><span class='comma'>,</span> <span class='const'>Tweet</span><span class='period'>.</span><span class='id from'>from</span><span class='lparen'>(</span><span class='id status'>status</span><span class='rparen'>)</span><span class='rparen'>)</span> <span class='kw'>end</span> <span class='kw'>end</span></pre> </td> @@ -1018,40 +1102,39 @@ <tr> <td> <pre class="lines"> -227 -228 -229 -230 -231 -232 -233 -234 -235 -236 -237 238 239 240 241 242 243 244 245 -246</pre> +246 +247 +248 +249 +250 +251 +252 +253 +254 +255 +256 +257</pre> </td> <td> - <pre class="code"><span class="info file"># File 'lib/safubot/twitter.rb', line 227</span> + <pre class="code"><span class="info file"># File 'lib/safubot/twitter.rb', line 238</span> <span class='kw'>def</span> <span class='id init_stream'>init_stream</span> <span class='ivar'>@stream</span> <span class='op'>=</span> <span class='const'>TweetStream</span><span class='op'>::</span><span class='const'>Client</span><span class='period'>.</span><span class='id new'>new</span><span class='lparen'>(</span><span class='ivar'>@opts</span><span class='rparen'>)</span> <span class='ivar'>@stream</span><span class='period'>.</span><span class='id on_direct_message'>on_direct_message</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id message'>message</span><span class='op'>|</span> - <span class='id req'>req</span> <span class='op'>=</span> <span class='id handle_message'>handle_message</span><span class='lparen'>(</span><span class='id message'>message</span><span class='rparen'>)</span> - <span class='id handle_request'>handle_request</span><span class='lparen'>(</span><span class='id req'>req</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id req'>req</span><span class='period'>.</span><span class='id is_a?'>is_a?</span> <span class='const'>Request</span> + <span class='id handle_message'>handle_message</span><span class='lparen'>(</span><span class='id message'>message</span><span class='rparen'>)</span> <span class='kw'>end</span> <span class='ivar'>@stream</span><span class='period'>.</span><span class='id on_error'>on_error</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id err'>err</span><span class='op'>|</span> <span class='kw'>if</span> <span class='id err'>err</span><span class='period'>.</span><span class='id match'>match</span><span class='lparen'>(</span><span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>invalid status code: 401</span><span class='regexp_end'>/</span></span><span class='rparen'>)</span> <span class='const'>Log</span><span class='period'>.</span><span class='id error'>error</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>TweetStream authentication failure!</span><span class='tstring_end'>&quot;</span></span> @@ -1060,10 +1143,11 @@ <span class='kw'>end</span> <span class='kw'>end</span> <span class='ivar'>@stream</span><span class='period'>.</span><span class='id on_inited'>on_inited</span> <span class='kw'>do</span> <span class='const'>Log</span><span class='period'>.</span><span class='id info'>info</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>TweetStream client is online at @</span><span class='embexpr_beg'>#{</span><span class='ivar'>@username</span><span class='rbrace'>}</span><span class='tstring_content'> :3</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span> + <span class='id emit'>emit</span><span class='lparen'>(</span><span class='symbol'>:ready</span><span class='rparen'>)</span> <span class='kw'>end</span> <span class='kw'>end</span></pre> </td> </tr> </table> @@ -1094,28 +1178,28 @@ <tr> <td> <pre class="lines"> -210 -211 -212 -213 -214 -215 -216 -217 -218 -219 -220 221 222 223 -224</pre> +224 +225 +226 +227 +228 +229 +230 +231 +232 +233 +234 +235</pre> </td> <td> - <pre class="code"><span class="info file"># File 'lib/safubot/twitter.rb', line 210</span> + <pre class="code"><span class="info file"># File 'lib/safubot/twitter.rb', line 221</span> <span class='kw'>def</span> <span class='id pull'>pull</span> <span class='kw'>begin</span> <span class='ivar'>@client</span><span class='period'>.</span><span class='id direct_messages'>direct_messages</span><span class='period'>.</span><span class='id each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id message'>message</span><span class='op'>|</span> <span class='id handle_message'>handle_message</span><span class='lparen'>(</span><span class='id message'>message</span><span class='rparen'>)</span> @@ -1196,16 +1280,16 @@ <tr> <td> <pre class="lines"> -204 -205 -206</pre> +215 +216 +217</pre> </td> <td> - <pre class="code"><span class="info file"># File 'lib/safubot/twitter.rb', line 204</span> + <pre class="code"><span class="info file"># File 'lib/safubot/twitter.rb', line 215</span> <span class='kw'>def</span> <span class='id reply'>reply</span><span class='lparen'>(</span><span class='id tweet'>tweet</span><span class='comma'>,</span> <span class='id text'>text</span><span class='rparen'>)</span> <span class='ivar'>@client</span><span class='period'>.</span><span class='id update'>update</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='id reply_header'>reply_header</span><span class='lparen'>(</span><span class='id tweet'>tweet</span><span class='rparen'>)</span><span class='rbrace'>}</span><span class='tstring_content'> </span><span class='embexpr_beg'>#{</span><span class='id text'>text</span><span class='rbrace'>}</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='symbol'>:in_reply_to_status_id</span> <span class='op'>=&gt;</span> <span class='id tweet'>tweet</span><span class='period'>.</span><span class='id raw'>raw</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>id</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='rparen'>)</span> <span class='kw'>end</span></pre> </td> @@ -1236,16 +1320,16 @@ <tr> <td> <pre class="lines"> -197 -198 -199</pre> +208 +209 +210</pre> </td> <td> - <pre class="code"><span class="info file"># File 'lib/safubot/twitter.rb', line 197</span> + <pre class="code"><span class="info file"># File 'lib/safubot/twitter.rb', line 208</span> <span class='kw'>def</span> <span class='id reply_header'>reply_header</span><span class='lparen'>(</span><span class='id tweet'>tweet</span><span class='rparen'>)</span> <span class='lparen'>(</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>@</span><span class='embexpr_beg'>#{</span><span class='id tweet'>tweet</span><span class='period'>.</span><span class='id username'>username</span><span class='rbrace'>}</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span> <span class='op'>+</span> <span class='lparen'>(</span><span class='id tweet'>tweet</span><span class='period'>.</span><span class='id header_mentions'>header_mentions</span> <span class='op'>-</span> <span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>@</span><span class='embexpr_beg'>#{</span><span class='ivar'>@username</span><span class='rbrace'>}</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span><span class='rparen'>)</span><span class='rparen'>)</span><span class='period'>.</span><span class='id join'>join</span> <span class='kw'>end</span></pre> </td> @@ -1276,20 +1360,20 @@ <tr> <td> <pre class="lines"> -267 -268 -269 -270 -271 -272 -273</pre> +277 +278 +279 +280 +281 +282 +283</pre> </td> <td> - <pre class="code"><span class="info file"># File 'lib/safubot/twitter.rb', line 267</span> + <pre class="code"><span class="info file"># File 'lib/safubot/twitter.rb', line 277</span> <span class='kw'>def</span> <span class='id run'>run</span> <span class='ivar'>@pid</span> <span class='op'>=</span> <span class='const'>Process</span><span class='period'>.</span><span class='id fork'>fork</span> <span class='kw'>do</span> <span class='const'>Signal</span><span class='period'>.</span><span class='id trap'>trap</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>TERM</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span> <span class='lbrace'>{</span> <span class='id stop'>stop</span> <span class='rbrace'>}</span> <span class='id init_stream'>init_stream</span> @@ -1324,44 +1408,42 @@ <tr> <td> <pre class="lines"> -249 -250 -251 -252 -253 -254 -255 -256 -257 -258 -259 260 261 262 263 -264</pre> +264 +265 +266 +267 +268 +269 +270 +271 +272 +273 +274</pre> </td> <td> - <pre class="code"><span class="info file"># File 'lib/safubot/twitter.rb', line 249</span> + <pre class="code"><span class="info file"># File 'lib/safubot/twitter.rb', line 260</span> <span class='kw'>def</span> <span class='id run_stream'>run_stream</span> <span class='kw'>begin</span> <span class='ivar'>@stream</span><span class='period'>.</span><span class='id userstream'>userstream</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id status'>status</span><span class='op'>|</span> -<span class='id req'>req</span> <span class='op'>=</span> <span class='id handle_tweet'>handle_tweet</span><span class='lparen'>(</span><span class='id status'>status</span><span class='rparen'>)</span> -<span class='id handle_request'>handle_request</span><span class='lparen'>(</span><span class='id req'>req</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id req'>req</span><span class='period'>.</span><span class='id is_a?'>is_a?</span> <span class='const'>Request</span> +<span class='id handle_tweet'>handle_tweet</span><span class='lparen'>(</span><span class='id status'>status</span><span class='rparen'>)</span> <span class='kw'>end</span> <span class='kw'>rescue</span> <span class='const'>Exception</span> <span class='op'>=&gt;</span> <span class='id e'>e</span> - <span class='kw'>unless</span> <span class='id e'>e</span><span class='period'>.</span><span class='id is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>Interrupt</span><span class='rparen'>)</span> <span class='op'>||</span> <span class='id e'>e</span><span class='period'>.</span><span class='id is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>SignalException</span><span class='rparen'>)</span> + <span class='kw'>if</span> <span class='id e'>e</span><span class='period'>.</span><span class='id is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>Interrupt</span><span class='rparen'>)</span> <span class='op'>||</span> <span class='id e'>e</span><span class='period'>.</span><span class='id is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>SignalException</span><span class='rparen'>)</span> +<span class='id stop'>stop</span> + <span class='kw'>else</span> <span class='const'>Log</span><span class='period'>.</span><span class='id error'>error</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>TweetStream client exited unexpectedly: </span><span class='embexpr_beg'>#{</span><span class='id error_report'>error_report</span><span class='lparen'>(</span><span class='id e'>e</span><span class='rparen'>)</span><span class='rbrace'>}</span><span class='tstring_end'>&quot;</span></span> <span class='const'>Log</span><span class='period'>.</span><span class='id error'>error</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Restarting TweetStream client in 5 seconds.</span><span class='tstring_end'>&quot;</span></span> <span class='id sleep'>sleep</span> <span class='int'>5</span><span class='semicolon'>;</span> <span class='id init_stream'>init_stream</span><span class='semicolon'>;</span> <span class='id run_stream'>run_stream</span> <span class='kw'>end</span> - <span class='kw'>else</span> - <span class='const'>Log</span><span class='period'>.</span><span class='id info'>info</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>TweetStream client shutdown complete.</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span> <span class='kw'>end</span> <span class='kw'>end</span></pre> </td> </tr> </table> @@ -1382,38 +1464,59 @@ </div> </div> <div class="tags"> + <h3>Parameters:</h3> +<ul class="param"> + <li> + + <span class='name'>resp</span> + + + <span class='type'></span> + + + + &mdash; + <div class='inline'><p> +Response to send. +</p> +</div> + + </li> + +</ul> + </div><table class="source_code"> <tr> <td> <pre class="lines"> -163 -164 -165 -166 -167 168 169 170 171 -172</pre> +172 +173 +174 +175 +176 +177</pre> </td> <td> - <pre class="code"><span class="info file"># File 'lib/safubot/twitter.rb', line 163</span> + <pre class="code"><span class="info file"># File 'lib/safubot/twitter.rb', line 168</span> <span class='kw'>def</span> <span class='id send'>send</span><span class='lparen'>(</span><span class='id resp'>resp</span><span class='rparen'>)</span> <span class='id source'>source</span> <span class='op'>=</span> <span class='id resp'>resp</span><span class='period'>.</span><span class='id request'>request</span><span class='period'>.</span><span class='id source'>source</span> <span class='kw'>if</span> <span class='id source'>source</span><span class='period'>.</span><span class='id is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>DirectMessage</span><span class='rparen'>)</span> <span class='ivar'>@client</span><span class='period'>.</span><span class='id direct_message_create'>direct_message_create</span><span class='lparen'>(</span><span class='id source'>source</span><span class='period'>.</span><span class='id raw'>raw</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>sender</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>screen_name</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='id resp'>resp</span><span class='period'>.</span><span class='id text'>text</span><span class='rparen'>)</span> <span class='kw'>elsif</span> <span class='id source'>source</span><span class='period'>.</span><span class='id is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>Tweet</span><span class='rparen'>)</span> - <span class='id reply'>reply</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='id source'>source</span><span class='period'>.</span><span class='id header_mentions'>header_mentions</span><span class='period'>.</span><span class='id join'>join</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'> </span><span class='tstring_end'>'</span></span><span class='rparen'>)</span><span class='rbrace'>}</span><span class='tstring_content'> </span><span class='embexpr_beg'>#{</span><span class='id resp'>resp</span><span class='period'>.</span><span class='id text'>text</span><span class='rbrace'>}</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span> + <span class='id reply'>reply</span> <span class='id source'>source</span><span class='comma'>,</span> <span class='id resp'>resp</span><span class='period'>.</span><span class='id text'>text</span> <span class='kw'>else</span> <span class='id raise'>raise</span> <span class='const'>NotImplementedError</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Don't know how to send response to a </span><span class='embexpr_beg'>#{</span><span class='id req'>req</span><span class='period'>.</span><span class='id source'>source</span><span class='period'>.</span><span class='id class'>class</span><span class='rbrace'>}</span><span class='tstring_content'>!</span><span class='tstring_end'>&quot;</span></span> <span class='kw'>end</span> <span class='kw'>end</span></pre> </td> @@ -1444,21 +1547,31 @@ <tr> <td> <pre class="lines"> -276 -277 -278 -279</pre> +286 +287 +288 +289 +290 +291 +292 +293 +294</pre> </td> <td> - <pre class="code"><span class="info file"># File 'lib/safubot/twitter.rb', line 276</span> + <pre class="code"><span class="info file"># File 'lib/safubot/twitter.rb', line 286</span> <span class='kw'>def</span> <span class='id stop'>stop</span> - <span class='ivar'>@stream</span><span class='period'>.</span><span class='id stop'>stop</span> <span class='kw'>if</span> <span class='ivar'>@stream</span> - <span class='const'>Process</span><span class='period'>.</span><span class='id kill'>kill</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>TERM</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='ivar'>@pid</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='ivar'>@pid</span> + <span class='kw'>if</span> <span class='ivar'>@stream</span> + <span class='ivar'>@stream</span><span class='period'>.</span><span class='id stop'>stop</span> + <span class='ivar'>@stream</span> <span class='op'>=</span> <span class='kw'>nil</span> + <span class='const'>Log</span><span class='period'>.</span><span class='id info'>info</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>TweetStream client shutdown complete.</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span> + <span class='kw'>else</span> + <span class='const'>Process</span><span class='period'>.</span><span class='id kill'>kill</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>TERM</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='ivar'>@pid</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='ivar'>@pid</span> + <span class='kw'>end</span> <span class='kw'>end</span></pre> </td> </tr> </table> </div> @@ -1466,10 +1579,10 @@ </div> </div> <div id="footer"> - Generated on Tue Nov 29 11:44:04 2011 by + Generated on Thu Dec 1 18:19:17 2011 by <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a> 0.7.3 (ruby-1.9.2). </div> </body> \ No newline at end of file