safubot 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (89) hide show
  1. data/.yardoc/checksums +9 -0
  2. data/.yardoc/objects/root.dat +0 -0
  3. data/.yardoc/proxy_types +0 -0
  4. data/README.md +52 -1
  5. data/doc/Safubot/Bot.html +1287 -652
  6. data/doc/Safubot/Evented.html +409 -276
  7. data/doc/Safubot/KnownUser.html +476 -254
  8. data/doc/Safubot/Log.html +184 -192
  9. data/doc/Safubot/Query.html +131 -164
  10. data/doc/Safubot/Request.html +158 -147
  11. data/doc/Safubot/Response.html +92 -135
  12. data/doc/Safubot/Test.html +166 -187
  13. data/doc/Safubot/Twitter/Bot.html +1005 -455
  14. data/doc/Safubot/Twitter/DirectMessage.html +417 -238
  15. data/doc/Safubot/Twitter/Tweet.html +725 -398
  16. data/doc/Safubot/Twitter.html +69 -116
  17. data/doc/Safubot/XMPP/Bot.html +625 -303
  18. data/doc/Safubot/XMPP/Message.html +372 -217
  19. data/doc/Safubot/XMPP.html +69 -116
  20. data/doc/Safubot.html +155 -126
  21. data/doc/_index.html +294 -0
  22. data/doc/class_list.html +47 -0
  23. data/doc/css/common.css +1 -0
  24. data/doc/css/full_list.css +55 -0
  25. data/doc/css/style.css +322 -0
  26. data/doc/file.README.html +140 -0
  27. data/doc/file_list.html +49 -0
  28. data/doc/frames.html +13 -0
  29. data/doc/index.html +129 -101
  30. data/doc/js/app.js +205 -0
  31. data/doc/js/full_list.js +167 -0
  32. data/doc/js/jquery.js +3 -5
  33. data/doc/method_list.html +638 -0
  34. data/doc/top-level-namespace.html +103 -0
  35. data/lib/safubot/bot.rb +22 -20
  36. data/lib/safubot/known_user.rb +2 -0
  37. data/lib/safubot/twitter.rb +30 -26
  38. data/lib/safubot/version.rb +1 -1
  39. data/lib/safubot/xmpp.rb +20 -14
  40. data/safubot.gemspec +1 -0
  41. metadata +50 -71
  42. data/doc/Gemfile.html +0 -119
  43. data/doc/Object.html +0 -171
  44. data/doc/Rakefile.html +0 -117
  45. data/doc/created.rid +0 -14
  46. data/doc/foo_rb.html +0 -115
  47. data/doc/images/add.png +0 -0
  48. data/doc/images/brick.png +0 -0
  49. data/doc/images/brick_link.png +0 -0
  50. data/doc/images/bug.png +0 -0
  51. data/doc/images/bullet_black.png +0 -0
  52. data/doc/images/bullet_toggle_minus.png +0 -0
  53. data/doc/images/bullet_toggle_plus.png +0 -0
  54. data/doc/images/date.png +0 -0
  55. data/doc/images/delete.png +0 -0
  56. data/doc/images/find.png +0 -0
  57. data/doc/images/loadingAnimation.gif +0 -0
  58. data/doc/images/macFFBgHack.png +0 -0
  59. data/doc/images/package.png +0 -0
  60. data/doc/images/page_green.png +0 -0
  61. data/doc/images/page_white_text.png +0 -0
  62. data/doc/images/page_white_width.png +0 -0
  63. data/doc/images/plugin.png +0 -0
  64. data/doc/images/ruby.png +0 -0
  65. data/doc/images/tag_blue.png +0 -0
  66. data/doc/images/tag_green.png +0 -0
  67. data/doc/images/transparent.png +0 -0
  68. data/doc/images/wrench.png +0 -0
  69. data/doc/images/wrench_orange.png +0 -0
  70. data/doc/images/zoom.png +0 -0
  71. data/doc/js/darkfish.js +0 -153
  72. data/doc/js/navigation.js +0 -142
  73. data/doc/js/search.js +0 -94
  74. data/doc/js/search_index.js +0 -1
  75. data/doc/js/searcher.js +0 -228
  76. data/doc/lib/safubot/bot_rb.html +0 -115
  77. data/doc/lib/safubot/evented_rb.html +0 -115
  78. data/doc/lib/safubot/known_user_rb.html +0 -115
  79. data/doc/lib/safubot/log_rb.html +0 -115
  80. data/doc/lib/safubot/safubot_rb.html +0 -115
  81. data/doc/lib/safubot/spec/bot_spec_rb.html +0 -115
  82. data/doc/lib/safubot/spec/twitter_spec_rb.html +0 -137
  83. data/doc/lib/safubot/test_helper_rb.html +0 -115
  84. data/doc/lib/safubot/twitter_rb.html +0 -115
  85. data/doc/lib/safubot/version_rb.html +0 -115
  86. data/doc/lib/safubot/xmpp_rb.html +0 -115
  87. data/doc/lib/safubot_rb.html +0 -115
  88. data/doc/rdoc.css +0 -543
  89. data/doc/table_of_contents.html +0 -224
@@ -1,346 +1,479 @@
1
- <!DOCTYPE html>
2
-
3
- <html>
4
- <head>
5
- <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4
+ <head>
5
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6
+ <title>
7
+ Module: Safubot::Evented
8
+
9
+ &mdash; Documentation by YARD 0.7.3
10
+
11
+ </title>
6
12
 
7
- <title>Module: Safubot::Evented</title>
13
+ <link rel="stylesheet" href="../css/style.css" type="text/css" media="screen" charset="utf-8" />
8
14
 
9
- <link type="text/css" media="screen" href="../rdoc.css" rel="stylesheet">
15
+ <link rel="stylesheet" href="../css/common.css" type="text/css" media="screen" charset="utf-8" />
10
16
 
11
- <script type="text/javascript">
12
- var rdoc_rel_prefix = "../";
17
+ <script type="text/javascript" charset="utf-8">
18
+ relpath = '..';
19
+ if (relpath != '') relpath += '/';
13
20
  </script>
14
21
 
15
- <script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
16
- <script type="text/javascript" charset="utf-8" src="../js/navigation.js"></script>
17
- <script type="text/javascript" charset="utf-8" src="../js/search_index.js"></script>
18
- <script type="text/javascript" charset="utf-8" src="../js/search.js"></script>
19
- <script type="text/javascript" charset="utf-8" src="../js/searcher.js"></script>
20
- <script type="text/javascript" charset="utf-8" src="../js/darkfish.js"></script>
21
-
22
-
23
- <body id="top" class="module">
24
- <nav id="metadata">
25
- <nav id="home-section" class="section">
26
- <h3 class="section-header">
27
- <a href="../index.html">Home</a>
28
- <a href="../table_of_contents.html#classes">Classes</a>
29
- <a href="../table_of_contents.html#methods">Methods</a>
30
- </h3>
31
- </nav>
32
-
33
-
34
- <nav id="search-section" class="section project-section" class="initially-hidden">
35
- <form action="#" method="get" accept-charset="utf-8">
36
- <h3 class="section-header">
37
- <input type="text" name="search" placeholder="Search" id="search-field"
38
- title="Type to search, Up and Down to navigate, Enter to load">
39
- </h3>
40
- </form>
41
-
42
- <ul id="search-results" class="initially-hidden"></ul>
43
- </nav>
44
-
45
-
46
- <div id="file-metadata">
47
- <nav id="file-list-section" class="section">
48
- <h3 class="section-header">Defined In</h3>
49
- <ul>
50
- <li>lib/safubot/evented.rb
51
- </ul>
52
- </nav>
22
+ <script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
23
+
24
+ <script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
53
25
 
54
-
55
- </div>
56
26
 
57
- <div id="class-metadata">
27
+ </head>
28
+ <body>
29
+ <script type="text/javascript" charset="utf-8">
30
+ if (window.top.frames.main) document.body.className = 'frames';
31
+ </script>
58
32
 
33
+ <div id="header">
34
+ <div id="menu">
35
+
36
+ <a href="../_index.html">Index (E)</a> &raquo;
37
+ <span class='title'><span class='object_link'><a href="../Safubot.html" title="Safubot (module)">Safubot</a></span></span>
38
+ &raquo;
39
+ <span class="title">Evented</span>
40
+
41
+
42
+ <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
43
+ </div>
44
+
45
+ <div id="search">
46
+
47
+ <a id="class_list_link" href="#">Class List</a>
48
+
49
+ <a id="method_list_link" href="#">Method List</a>
50
+
51
+ <a id="file_list_link" href="#">File List</a>
52
+
53
+ </div>
54
+ <div class="clear"></div>
55
+ </div>
59
56
 
57
+ <iframe id="search_frame"></iframe>
60
58
 
61
- <!-- Method Quickref -->
62
- <nav id="method-list-section" class="section">
63
- <h3 class="section-header">Methods</h3>
59
+ <div id="content"><h1>Module: Safubot::Evented
60
+
61
+
62
+
63
+ </h1>
64
64
 
65
- <ul class="link-list">
65
+ <dl class="box">
66
+
67
+
66
68
 
67
- <li><a href="#method-i-bind">#bind</a>
69
+
68
70
 
69
- <li><a href="#method-i-emit">#emit</a>
71
+
72
+
73
+ <dt class="r1">Included in:</dt>
74
+ <dd class="r1"><span class='object_link'><a href="Bot.html" title="Safubot::Bot (class)">Bot</a></span>, <span class='object_link'><a href="Twitter/Bot.html" title="Safubot::Twitter::Bot (class)">Twitter::Bot</a></span>, <span class='object_link'><a href="XMPP/Bot.html" title="Safubot::XMPP::Bot (class)">XMPP::Bot</a></span></dd>
70
75
 
71
- <li><a href="#method-i-on">#on</a>
76
+
77
+
78
+ <dt class="r2 last">Defined in:</dt>
79
+ <dd class="r2 last">lib/safubot/evented.rb</dd>
80
+
81
+ </dl>
82
+ <div class="clear"></div>
83
+
84
+ <h2>Overview</h2><div class="docstring">
85
+ <div class="discussion">
86
+ <p>
87
+ A mixin granting simple event firing and handler binding.
88
+ </p>
89
+
90
+
91
+ </div>
92
+ </div>
93
+ <div class="tags">
94
+
95
+
96
+ </div>
97
+
98
+
99
+
100
+
101
+
102
+ <h2>
103
+ Instance Method Summary
104
+ <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
105
+ </h2>
106
+
107
+ <ul class="summary">
108
+
109
+ <li class="public ">
110
+ <span class="summary_signature">
72
111
 
73
- <li><a href="#method-i-once">#once</a>
112
+ <a href="#bind-instance_method" title="#bind (instance method)">- (Object) <strong>bind</strong>(evid, handler) </a>
74
113
 
75
- <li><a href="#method-i-unbind">#unbind</a>
114
+
76
115
 
77
- </ul>
78
- </nav>
116
+ </span>
117
+
118
+
119
+
120
+
121
+
122
+
79
123
 
80
- </div>
124
+
125
+ <span class="summary_desc"><div class='inline'><p>
126
+ Binds an event handler, which is a Hash of the form:.
127
+ </p>
128
+ </div></span>
129
+
130
+ </li>
81
131
 
82
- <div id="project-metadata">
83
- <nav id="fileindex-section" class="section project-section">
84
- <h3 class="section-header">Pages</h3>
132
+
133
+ <li class="public ">
134
+ <span class="summary_signature">
135
+
136
+ <a href="#emit-instance_method" title="#emit (instance method)">- (Object) <strong>emit</strong>(evid, *args) </a>
137
+
85
138
 
86
- <ul>
139
+
140
+ </span>
141
+
142
+
143
+
87
144
 
88
- <li class="file"><a href="../Gemfile.html">Gemfile</a>
89
145
 
90
- <li class="file"><a href="../Rakefile.html">Rakefile</a>
91
146
 
92
- </ul>
93
- </nav>
94
147
 
95
- <nav id="classindex-section" class="section project-section">
96
- <h3 class="section-header">Class and Module Index</h3>
148
+
149
+ <span class="summary_desc"><div class='inline'><p>
150
+ Fires an evid event with the given arguments.
151
+ </p>
152
+ </div></span>
153
+
154
+ </li>
155
+
156
+
157
+ <li class="public ">
158
+ <span class="summary_signature">
159
+
160
+ <a href="#on-instance_method" title="#on (instance method)">- (Object) <strong>on</strong>(evid, opts = {}, &amp;callback) </a>
161
+
97
162
 
98
- <ul class="link-list">
163
+
164
+ </span>
99
165
 
100
- <li><a href="../Safubot.html">Safubot</a>
101
166
 
102
- <li><a href="../Safubot/Bot.html">Safubot::Bot</a>
103
167
 
104
- <li><a href="../Safubot/Evented.html">Safubot::Evented</a>
105
168
 
106
- <li><a href="../Safubot/KnownUser.html">Safubot::KnownUser</a>
107
169
 
108
- <li><a href="../Safubot/Log.html">Safubot::Log</a>
109
170
 
110
- <li><a href="../Safubot/Query.html">Safubot::Query</a>
171
+
111
172
 
112
- <li><a href="../Safubot/Request.html">Safubot::Request</a>
173
+ <span class="summary_desc"><div class='inline'><p>
174
+ Binds a block to the specified event id.
175
+ </p>
176
+ </div></span>
113
177
 
114
- <li><a href="../Safubot/Response.html">Safubot::Response</a>
178
+ </li>
179
+
180
+
181
+ <li class="public ">
182
+ <span class="summary_signature">
183
+
184
+ <a href="#once-instance_method" title="#once (instance method)">- (Object) <strong>once</strong>(evid, opts = {}, &amp;callback) </a>
185
+
186
+
187
+
188
+ </span>
115
189
 
116
- <li><a href="../Safubot/Test.html">Safubot::Test</a>
117
190
 
118
- <li><a href="../Safubot/Twitter.html">Safubot::Twitter</a>
119
191
 
120
- <li><a href="../Safubot/Twitter/Bot.html">Safubot::Twitter::Bot</a>
121
192
 
122
- <li><a href="../Safubot/Twitter/DirectMessage.html">Safubot::Twitter::DirectMessage</a>
123
193
 
124
- <li><a href="../Safubot/Twitter/Tweet.html">Safubot::Twitter::Tweet</a>
125
194
 
126
- <li><a href="../Safubot/XMPP.html">Safubot::XMPP</a>
195
+
196
+
197
+ <span class="summary_desc"><div class='inline'><p>
198
+ Binds a block to the specified event id, to be executed only once.
199
+ </p>
200
+ </div></span>
201
+
202
+ </li>
203
+
204
+
205
+ <li class="public ">
206
+ <span class="summary_signature">
207
+
208
+ <a href="#unbind-instance_method" title="#unbind (instance method)">- (Object) <strong>unbind</strong>(handler) </a>
209
+
210
+
211
+
212
+ </span>
213
+
214
+
127
215
 
128
- <li><a href="../Safubot/XMPP/Bot.html">Safubot::XMPP::Bot</a>
129
216
 
130
- <li><a href="../Safubot/XMPP/Message.html">Safubot::XMPP::Message</a>
131
217
 
132
- <li><a href="../Object.html">Object</a>
133
218
 
134
- </ul>
135
- </nav>
136
219
 
137
- </div>
138
- </nav>
220
+
221
+ <span class="summary_desc"><div class='inline'><p>
222
+ Unbinds the given handler.
223
+ </p>
224
+ </div></span>
225
+
226
+ </li>
139
227
 
140
- <div id="documentation">
141
- <h1 class="module">module Safubot::Evented</h1>
228
+
229
+ </ul>
230
+
142
231
 
143
- <div id="description" class="description">
144
-
145
- <p>A mixin granting simple event firing and handler binding.</p>
146
232
 
147
- </div><!-- description -->
148
233
 
234
+ <div id="instance_method_details" class="method_details_list">
235
+ <h2>Instance Method Details</h2>
236
+
237
+
238
+ <div class="method_details first">
239
+ <p class="signature first" id="bind-instance_method">
149
240
 
241
+ - (<tt>Object</tt>) <strong>bind</strong>(evid, handler)
150
242
 
243
+
151
244
 
152
- <section id="5Buntitled-5D" class="documentation-section">
153
-
245
+ </p><div class="docstring">
246
+ <div class="discussion">
247
+ <p>
248
+ Binds an event handler, which is a Hash of the form:
249
+ </p>
250
+ <p>
251
+ { :evid => Symbol, :id => Symbol, :repeat => Boolean, :proc => Proc }
252
+ </p>
253
+ <p>
254
+ See on[rdoc-ref:Safubot::Evented#on] and
255
+ once[rdoc-ref:Safubot::Evented#once] for sugar.
256
+ </p>
154
257
 
155
-
156
258
 
157
-
259
+ </div>
260
+ </div>
261
+ <div class="tags">
262
+
158
263
 
264
+ </div><table class="source_code">
265
+ <tr>
266
+ <td>
267
+ <pre class="lines">
268
+
269
+
270
+ 11
271
+ 12
272
+ 13
273
+ 14
274
+ 15
275
+ 16
276
+ 17</pre>
277
+ </td>
278
+ <td>
279
+ <pre class="code"><span class="info file"># File 'lib/safubot/evented.rb', line 11</span>
280
+
281
+ <span class='kw'>def</span> <span class='id bind'>bind</span><span class='lparen'>(</span><span class='id evid'>evid</span><span class='comma'>,</span> <span class='id handler'>handler</span><span class='rparen'>)</span>
282
+ <span class='ivar'>@handlers</span> <span class='op'>||=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
283
+ <span class='ivar'>@handlers</span><span class='lbracket'>[</span><span class='id evid'>evid</span><span class='rbracket'>]</span> <span class='op'>||=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
284
+ <span class='id handler'>handler</span><span class='lbracket'>[</span><span class='symbol'>:evid</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id evid'>evid</span>
285
+ <span class='id handler'>handler</span><span class='lbracket'>[</span><span class='symbol'>:id</span><span class='rbracket'>]</span> <span class='op'>||=</span> <span class='ivar'>@handlers</span><span class='lbracket'>[</span><span class='id evid'>evid</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id length'>length</span>
286
+ <span class='ivar'>@handlers</span><span class='lbracket'>[</span><span class='id evid'>evid</span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='id handler'>handler</span><span class='lbracket'>[</span><span class='symbol'>:id</span><span class='rbracket'>]</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id handler'>handler</span>
287
+ <span class='kw'>end</span></pre>
288
+ </td>
289
+ </tr>
290
+ </table>
291
+ </div>
159
292
 
293
+ <div class="method_details ">
294
+ <p class="signature " id="emit-instance_method">
295
+
296
+ - (<tt>Object</tt>) <strong>emit</strong>(evid, *args)
297
+
160
298
 
161
- <!-- Methods -->
162
-
163
- <section id="public-instance-5Buntitled-5D-method-details" class="method-section section">
164
- <h3 class="section-header">Public Instance Methods</h3>
299
+
300
+ </p><div class="docstring">
301
+ <div class="discussion">
302
+ <p>
303
+ Fires an evid event with the given arguments.
304
+ </p>
165
305
 
166
-
167
- <div id="method-i-bind" class="method-detail ">
168
-
169
- <div class="method-heading">
170
- <span class="method-name">bind</span><span
171
- class="method-args">(evid, handler)</span>
172
- <span class="method-click-advice">click to toggle source</span>
173
- </div>
174
-
175
-
176
- <div class="method-description">
177
-
178
- <p>Binds an event handler, which is a Hash of the form:</p>
179
-
180
- <pre class="ruby">{ :<span class="ruby-identifier">evid</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-constant">Symbol</span>, :<span class="ruby-identifier">id</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-constant">Symbol</span>, :<span class="ruby-identifier">repeat</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-constant">Boolean</span>, :<span class="ruby-identifier">proc</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-constant">Proc</span> }
181
- </pre>
182
-
183
- <p>See on and once for sugar.</p>
184
-
185
-
186
-
187
- <div class="method-source-code" id="bind-source">
188
- <pre><span class="ruby-comment"># File lib/safubot/evented.rb, line 10</span>
189
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">bind</span>(<span class="ruby-identifier">evid</span>, <span class="ruby-identifier">handler</span>)
190
- <span class="ruby-ivar">@handlers</span> <span class="ruby-operator">||=</span> {}
191
- <span class="ruby-ivar">@handlers</span>[<span class="ruby-identifier">evid</span>] <span class="ruby-operator">||=</span> {}
192
- <span class="ruby-identifier">handler</span>[<span class="ruby-value">:evid</span>] = <span class="ruby-identifier">evid</span>
193
- <span class="ruby-identifier">handler</span>[<span class="ruby-value">:id</span>] <span class="ruby-operator">||=</span> <span class="ruby-ivar">@handlers</span>[<span class="ruby-identifier">evid</span>].<span class="ruby-identifier">length</span>
194
- <span class="ruby-ivar">@handlers</span>[<span class="ruby-identifier">evid</span>][<span class="ruby-identifier">handler</span>[<span class="ruby-value">:id</span>]] = <span class="ruby-identifier">handler</span>
195
- <span class="ruby-keyword">end</span></pre>
196
- </div><!-- bind-source -->
197
-
198
- </div>
199
-
200
-
201
-
202
-
203
- </div><!-- bind-method -->
204
306
 
205
-
206
- <div id="method-i-emit" class="method-detail ">
207
-
208
- <div class="method-heading">
209
- <span class="method-name">emit</span><span
210
- class="method-args">(evid, *args)</span>
211
- <span class="method-click-advice">click to toggle source</span>
212
- </div>
213
-
214
-
215
- <div class="method-description">
216
-
217
- <p>Fires an evid event with the given arguments.</p>
218
-
219
-
220
-
221
- <div class="method-source-code" id="emit-source">
222
- <pre><span class="ruby-comment"># File lib/safubot/evented.rb, line 36</span>
223
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">emit</span>(<span class="ruby-identifier">evid</span>, *<span class="ruby-identifier">args</span>)
224
- <span class="ruby-keyword">return</span> <span class="ruby-keyword">unless</span> <span class="ruby-ivar">@handlers</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-ivar">@handlers</span>[<span class="ruby-identifier">evid</span>]
225
- <span class="ruby-ivar">@handlers</span>[<span class="ruby-identifier">evid</span>].<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">id</span>, <span class="ruby-identifier">handler</span><span class="ruby-operator">|</span>
226
- <span class="ruby-keyword">begin</span>
227
- <span class="ruby-identifier">handler</span>[<span class="ruby-value">:proc</span>].<span class="ruby-identifier">call</span>(*<span class="ruby-identifier">args</span>)
228
- <span class="ruby-keyword">ensure</span>
229
- <span class="ruby-ivar">@handlers</span>[<span class="ruby-identifier">evid</span>].<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">id</span>) <span class="ruby-keyword">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">handler</span>[<span class="ruby-value">:repeat</span>]
230
- <span class="ruby-keyword">end</span>
231
- <span class="ruby-keyword">end</span>
232
- <span class="ruby-keyword">end</span></pre>
233
- </div><!-- emit-source -->
234
-
235
- </div>
236
-
237
-
238
-
239
-
240
- </div><!-- emit-method -->
307
+ </div>
308
+ </div>
309
+ <div class="tags">
310
+
241
311
 
312
+ </div><table class="source_code">
313
+ <tr>
314
+ <td>
315
+ <pre class="lines">
316
+
317
+
318
+ 41
319
+ 42
320
+ 43
321
+ 44
322
+ 45
323
+ 46
324
+ 47
325
+ 48
326
+ 49
327
+ 50</pre>
328
+ </td>
329
+ <td>
330
+ <pre class="code"><span class="info file"># File 'lib/safubot/evented.rb', line 41</span>
331
+
332
+ <span class='kw'>def</span> <span class='id emit'>emit</span><span class='lparen'>(</span><span class='id evid'>evid</span><span class='comma'>,</span> <span class='op'>*</span><span class='id args'>args</span><span class='rparen'>)</span>
333
+ <span class='kw'>return</span> <span class='kw'>unless</span> <span class='ivar'>@handlers</span> <span class='op'>&amp;&amp;</span> <span class='ivar'>@handlers</span><span class='lbracket'>[</span><span class='id evid'>evid</span><span class='rbracket'>]</span>
334
+ <span class='ivar'>@handlers</span><span class='lbracket'>[</span><span class='id evid'>evid</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id id'>id</span><span class='comma'>,</span> <span class='id handler'>handler</span><span class='op'>|</span>
335
+ <span class='kw'>begin</span>
336
+ <span class='id handler'>handler</span><span class='lbracket'>[</span><span class='symbol'>:proc</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id call'>call</span><span class='lparen'>(</span><span class='op'>*</span><span class='id args'>args</span><span class='rparen'>)</span>
337
+ <span class='kw'>ensure</span>
338
+ <span class='ivar'>@handlers</span><span class='lbracket'>[</span><span class='id evid'>evid</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id delete'>delete</span><span class='lparen'>(</span><span class='id id'>id</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='op'>!</span><span class='id handler'>handler</span><span class='lbracket'>[</span><span class='symbol'>:repeat</span><span class='rbracket'>]</span>
339
+ <span class='kw'>end</span>
340
+ <span class='kw'>end</span>
341
+ <span class='kw'>end</span></pre>
342
+ </td>
343
+ </tr>
344
+ </table>
345
+ </div>
242
346
 
243
- <div id="method-i-on" class="method-detail ">
244
-
245
- <div class="method-heading">
246
- <span class="method-name">on</span><span
247
- class="method-args">(evid, opts={}, &callback)</span>
248
- <span class="method-click-advice">click to toggle source</span>
249
- </div>
250
-
251
-
252
- <div class="method-description">
253
-
254
- <p>Binds a block to the specified event id. Returns the bound handler.</p>
255
-
256
-
257
-
258
- <div class="method-source-code" id="on-source">
259
- <pre><span class="ruby-comment"># File lib/safubot/evented.rb, line 25</span>
260
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">on</span>(<span class="ruby-identifier">evid</span>, <span class="ruby-identifier">opts</span>={}, &amp;<span class="ruby-identifier">callback</span>)
261
- <span class="ruby-identifier">bind</span>(<span class="ruby-identifier">evid</span>, { <span class="ruby-value">:repeat</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword">true</span>, <span class="ruby-value">:proc</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">callback</span> }.<span class="ruby-identifier">merge</span>(<span class="ruby-identifier">opts</span>))
262
- <span class="ruby-keyword">end</span></pre>
263
- </div><!-- on-source -->
264
-
265
- </div>
266
-
267
-
268
-
269
-
270
- </div><!-- on-method -->
347
+ <div class="method_details ">
348
+ <p class="signature " id="on-instance_method">
349
+
350
+ - (<tt>Object</tt>) <strong>on</strong>(evid, opts = {}, &amp;callback)
351
+
352
+
353
+
354
+ </p><div class="docstring">
355
+ <div class="discussion">
356
+ <p>
357
+ Binds a block to the specified event id. Returns the bound handler.
358
+ </p>
271
359
 
272
-
273
- <div id="method-i-once" class="method-detail ">
274
-
275
- <div class="method-heading">
276
- <span class="method-name">once</span><span
277
- class="method-args">(evid, opts={}, &callback)</span>
278
- <span class="method-click-advice">click to toggle source</span>
279
- </div>
280
-
281
-
282
- <div class="method-description">
283
-
284
- <p>Binds a block to the specified event id, to be executed only once. Returns
285
- the bound handler.</p>
286
-
287
-
288
-
289
- <div class="method-source-code" id="once-source">
290
- <pre><span class="ruby-comment"># File lib/safubot/evented.rb, line 31</span>
291
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">once</span>(<span class="ruby-identifier">evid</span>, <span class="ruby-identifier">opts</span>={}, &amp;<span class="ruby-identifier">callback</span>)
292
- <span class="ruby-identifier">bind</span>(<span class="ruby-identifier">evid</span>, { <span class="ruby-value">:repeat</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword">false</span>, <span class="ruby-value">:proc</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">callback</span> }.<span class="ruby-identifier">merge</span>(<span class="ruby-identifier">opts</span>))
293
- <span class="ruby-keyword">end</span></pre>
294
- </div><!-- once-source -->
295
-
296
- </div>
297
-
298
-
299
-
300
-
301
- </div><!-- once-method -->
302
360
 
361
+ </div>
362
+ </div>
363
+ <div class="tags">
364
+
365
+
366
+ </div><table class="source_code">
367
+ <tr>
368
+ <td>
369
+ <pre class="lines">
370
+
371
+
372
+ 28
373
+ 29
374
+ 30</pre>
375
+ </td>
376
+ <td>
377
+ <pre class="code"><span class="info file"># File 'lib/safubot/evented.rb', line 28</span>
378
+
379
+ <span class='kw'>def</span> <span class='id on'>on</span><span class='lparen'>(</span><span class='id evid'>evid</span><span class='comma'>,</span> <span class='id opts'>opts</span><span class='op'>=</span><span class='lbrace'>{</span><span class='rbrace'>}</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id callback'>callback</span><span class='rparen'>)</span>
380
+ <span class='id bind'>bind</span><span class='lparen'>(</span><span class='id evid'>evid</span><span class='comma'>,</span> <span class='lbrace'>{</span> <span class='symbol'>:repeat</span> <span class='op'>=&gt;</span> <span class='kw'>true</span><span class='comma'>,</span> <span class='symbol'>:proc</span> <span class='op'>=&gt;</span> <span class='id callback'>callback</span> <span class='rbrace'>}</span><span class='period'>.</span><span class='id merge'>merge</span><span class='lparen'>(</span><span class='id opts'>opts</span><span class='rparen'>)</span><span class='rparen'>)</span>
381
+ <span class='kw'>end</span></pre>
382
+ </td>
383
+ </tr>
384
+ </table>
385
+ </div>
303
386
 
304
- <div id="method-i-unbind" class="method-detail ">
305
-
306
- <div class="method-heading">
307
- <span class="method-name">unbind</span><span
308
- class="method-args">(handler)</span>
309
- <span class="method-click-advice">click to toggle source</span>
310
- </div>
311
-
312
-
313
- <div class="method-description">
314
-
315
- <p>Unbinds the given handler.</p>
316
-
317
-
318
-
319
- <div class="method-source-code" id="unbind-source">
320
- <pre><span class="ruby-comment"># File lib/safubot/evented.rb, line 19</span>
321
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">unbind</span>(<span class="ruby-identifier">handler</span>)
322
- <span class="ruby-ivar">@handlers</span>[<span class="ruby-identifier">handler</span>[<span class="ruby-value">:evid</span>]].<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">handler</span>[<span class="ruby-value">:id</span>])
323
- <span class="ruby-keyword">end</span></pre>
324
- </div><!-- unbind-source -->
325
-
326
- </div>
327
-
328
-
329
-
330
-
331
- </div><!-- unbind-method -->
387
+ <div class="method_details ">
388
+ <p class="signature " id="once-instance_method">
389
+
390
+ - (<tt>Object</tt>) <strong>once</strong>(evid, opts = {}, &amp;callback)
391
+
332
392
 
393
+
394
+ </p><div class="docstring">
395
+ <div class="discussion">
396
+ <p>
397
+ Binds a block to the specified event id, to be executed only once. Returns
398
+ the bound handler.
399
+ </p>
400
+
401
+
402
+ </div>
403
+ </div>
404
+ <div class="tags">
405
+
406
+
407
+ </div><table class="source_code">
408
+ <tr>
409
+ <td>
410
+ <pre class="lines">
411
+
412
+
413
+ 35
414
+ 36
415
+ 37</pre>
416
+ </td>
417
+ <td>
418
+ <pre class="code"><span class="info file"># File 'lib/safubot/evented.rb', line 35</span>
419
+
420
+ <span class='kw'>def</span> <span class='id once'>once</span><span class='lparen'>(</span><span class='id evid'>evid</span><span class='comma'>,</span> <span class='id opts'>opts</span><span class='op'>=</span><span class='lbrace'>{</span><span class='rbrace'>}</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id callback'>callback</span><span class='rparen'>)</span>
421
+ <span class='id bind'>bind</span><span class='lparen'>(</span><span class='id evid'>evid</span><span class='comma'>,</span> <span class='lbrace'>{</span> <span class='symbol'>:repeat</span> <span class='op'>=&gt;</span> <span class='kw'>false</span><span class='comma'>,</span> <span class='symbol'>:proc</span> <span class='op'>=&gt;</span> <span class='id callback'>callback</span> <span class='rbrace'>}</span><span class='period'>.</span><span class='id merge'>merge</span><span class='lparen'>(</span><span class='id opts'>opts</span><span class='rparen'>)</span><span class='rparen'>)</span>
422
+ <span class='kw'>end</span></pre>
423
+ </td>
424
+ </tr>
425
+ </table>
426
+ </div>
333
427
 
334
- </section><!-- public-instance-method-details -->
428
+ <div class="method_details ">
429
+ <p class="signature " id="unbind-instance_method">
430
+
431
+ - (<tt>Object</tt>) <strong>unbind</strong>(handler)
335
432
 
336
- </section><!-- 5Buntitled-5D -->
337
433
 
338
- </div><!-- documentation -->
434
+
435
+ </p><div class="docstring">
436
+ <div class="discussion">
437
+ <p>
438
+ Unbinds the given handler.
439
+ </p>
339
440
 
340
441
 
341
- <footer id="validator-badges">
342
- <p><a href="http://validator.w3.org/check/referer">[Validate]</a>
343
- <p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 3.11.
344
- <p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
345
- </footer>
442
+ </div>
443
+ </div>
444
+ <div class="tags">
445
+
346
446
 
447
+ </div><table class="source_code">
448
+ <tr>
449
+ <td>
450
+ <pre class="lines">
451
+
452
+
453
+ 21
454
+ 22
455
+ 23</pre>
456
+ </td>
457
+ <td>
458
+ <pre class="code"><span class="info file"># File 'lib/safubot/evented.rb', line 21</span>
459
+
460
+ <span class='kw'>def</span> <span class='id unbind'>unbind</span><span class='lparen'>(</span><span class='id handler'>handler</span><span class='rparen'>)</span>
461
+ <span class='ivar'>@handlers</span><span class='lbracket'>[</span><span class='id handler'>handler</span><span class='lbracket'>[</span><span class='symbol'>:evid</span><span class='rbracket'>]</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id delete'>delete</span><span class='lparen'>(</span><span class='id handler'>handler</span><span class='lbracket'>[</span><span class='symbol'>:id</span><span class='rbracket'>]</span><span class='rparen'>)</span>
462
+ <span class='kw'>end</span></pre>
463
+ </td>
464
+ </tr>
465
+ </table>
466
+ </div>
467
+
468
+ </div>
469
+
470
+ </div>
471
+
472
+ <div id="footer">
473
+ Generated on Mon Nov 28 20:20:04 2011 by
474
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
475
+ 0.7.3 (ruby-1.9.2).
476
+ </div>
477
+
478
+ </body>
479
+ </html>