voteable_mongoid 0.5.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,505 +0,0 @@
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>Module: Mongoid::Voteable</title>
7
- <link rel="stylesheet" href="../css/style.css" type="text/css" media="screen" charset="utf-8" />
8
- <link rel="stylesheet" href="../css/common.css" type="text/css" media="screen" charset="utf-8" />
9
-
10
- <script type="text/javascript" charset="utf-8">
11
- relpath = '..';
12
- if (relpath != '') relpath += '/';
13
- </script>
14
- <script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
15
- <script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
16
-
17
- </head>
18
- <body>
19
- <script type="text/javascript" charset="utf-8">
20
- if (window.top.frames.main) document.body.className = 'frames';
21
- </script>
22
-
23
- <div id="header">
24
- <div id="menu">
25
-
26
- <a href="../_index.html">Index (V)</a> &raquo;
27
- <span class='title'><span class='object_link'><a href="../Mongoid.html" title="Mongoid (module)">Mongoid</a></span></span>
28
- &raquo;
29
- <span class="title">Voteable</span>
30
-
31
-
32
- <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
33
- </div>
34
-
35
- <div id="search">
36
- <a id="class_list_link" href="#">Class List</a>
37
- <a id="method_list_link" href="#">Method List</a>
38
- <a id ="file_list_link" href="#">File List</a>
39
- </div>
40
-
41
- <div class="clear"></div>
42
- </div>
43
-
44
- <iframe id="search_frame"></iframe>
45
-
46
- <div id="content"><h1>Module: Mongoid::Voteable
47
-
48
-
49
-
50
- </h1>
51
-
52
- <dl class="box">
53
-
54
-
55
-
56
- <dt class="r1">Extended by:</dt>
57
- <dd class="r1">ActiveSupport::Concern</dd>
58
-
59
-
60
-
61
-
62
-
63
-
64
-
65
- <dt class="r2 last">Defined in:</dt>
66
- <dd class="r2 last">lib/voteable_mongoid/voteable.rb<span class="defines">,<br />
67
- lib/voteable_mongoid/voteable/stats.rb</span>
68
- </dd>
69
-
70
- </dl>
71
- <div class="clear"></div>
72
-
73
- <h2>Defined Under Namespace</h2>
74
- <p class="children">
75
-
76
-
77
- <strong class="modules">Modules:</strong> <span class='object_link'><a href="Voteable/Stats.html" title="Mongoid::Voteable::Stats (module)">Stats</a></span>
78
-
79
-
80
-
81
-
82
- </p>
83
-
84
- <h2>Constant Summary</h2>
85
-
86
- <dl class="constants">
87
-
88
- <dt id="VOTEABLE-constant" class="">VOTEABLE =
89
- <div class="docstring">
90
- <div class="discussion">
91
-
92
- <p>How many points should be assigned for each up or down vote. This hash
93
- should manipulated using voteable method</p>
94
-
95
-
96
- </div>
97
- </div>
98
- <div class="tags">
99
-
100
- </div>
101
- </dt>
102
- <dd><pre class="code"><span class='lbrace token'>{</span><span class='rbrace token'>}</span>
103
- </pre></dd>
104
-
105
- </dl>
106
-
107
-
108
-
109
-
110
-
111
-
112
- <h2>
113
- Instance Method Summary
114
- <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
115
- </h2>
116
-
117
- <ul class="summary">
118
-
119
- <li class="public ">
120
- <span class="summary_signature">
121
-
122
- <a href="#down_voter_ids-instance_method" title="#down_voter_ids (instance method)">- (Object) <strong>down_voter_ids</strong> </a>
123
-
124
-
125
-
126
- </span>
127
-
128
-
129
-
130
-
131
-
132
-
133
-
134
-
135
- <span class="summary_desc"><div class='inline'>
136
- <p>Array of down voter ids.</p>
137
- </div></span>
138
-
139
- </li>
140
-
141
-
142
- <li class="public ">
143
- <span class="summary_signature">
144
-
145
- <a href="#up_voter_ids-instance_method" title="#up_voter_ids (instance method)">- (Object) <strong>up_voter_ids</strong> </a>
146
-
147
-
148
-
149
- </span>
150
-
151
-
152
-
153
-
154
-
155
-
156
-
157
-
158
- <span class="summary_desc"><div class='inline'>
159
- <p>Array of up voter ids.</p>
160
- </div></span>
161
-
162
- </li>
163
-
164
-
165
- <li class="public ">
166
- <span class="summary_signature">
167
-
168
- <a href="#vote-instance_method" title="#vote (instance method)">- (Object) <strong>vote</strong>(options) </a>
169
-
170
-
171
-
172
- </span>
173
-
174
-
175
-
176
-
177
-
178
-
179
-
180
-
181
- <span class="summary_desc"><div class='inline'>
182
- <p>Make a vote on this votee.</p>
183
- </div></span>
184
-
185
- </li>
186
-
187
-
188
- <li class="public ">
189
- <span class="summary_signature">
190
-
191
- <a href="#vote_value-instance_method" title="#vote_value (instance method)">- (Object) <strong>vote_value</strong>(voter) </a>
192
-
193
-
194
-
195
- </span>
196
-
197
-
198
-
199
-
200
-
201
-
202
-
203
-
204
- <span class="summary_desc"><div class='inline'>
205
- <p>Get a voted value on this votee.</p>
206
- </div></span>
207
-
208
- </li>
209
-
210
-
211
- <li class="public ">
212
- <span class="summary_signature">
213
-
214
- <a href="#voteable-instance_method" title="#voteable (instance method)">- (Object) <strong>voteable</strong> </a>
215
-
216
-
217
-
218
- </span>
219
-
220
-
221
-
222
-
223
-
224
-
225
-
226
-
227
- <span class="summary_desc"><div class='inline'></div></span>
228
-
229
- </li>
230
-
231
-
232
- </ul>
233
-
234
-
235
-
236
-
237
-
238
- <div id="instance_method_details" class="method_details_list">
239
- <h2>Instance Method Details</h2>
240
-
241
-
242
- <div class="method_details first">
243
- <p class="signature first" id="down_voter_ids-instance_method">
244
-
245
- - (<tt>Object</tt>) <strong>down_voter_ids</strong>
246
-
247
-
248
-
249
- </p><div class="docstring">
250
- <div class="discussion">
251
-
252
- <p>Array of down voter ids</p>
253
-
254
-
255
- </div>
256
- </div>
257
- <div class="tags">
258
-
259
- </div><table class="source_code">
260
- <tr>
261
- <td>
262
- <pre class="lines">
263
-
264
-
265
- 238
266
- 239
267
- 240</pre>
268
- </td>
269
- <td>
270
- <pre class="code"><span class="info file"># File 'lib/voteable_mongoid/voteable.rb', line 238</span>
271
-
272
- <span class='def def kw'>def</span> <span class='down_voter_ids identifier id'>down_voter_ids</span>
273
- <span class='voteable identifier id'>voteable</span><span class='dot token'>.</span><span class='try identifier id'>try</span><span class='lparen token'>(</span><span class='symbol val'>:[]</span><span class='comma token'>,</span> <span class='string val'>'down_voter_ids'</span><span class='rparen token'>)</span> <span class='orop op'>||</span> <span class='lbrack token'>[</span><span class='rbrack token'>]</span>
274
- <span class='end end kw'>end</span>
275
- </pre>
276
- </td>
277
- </tr>
278
- </table>
279
- </div>
280
-
281
- <div class="method_details ">
282
- <p class="signature " id="up_voter_ids-instance_method">
283
-
284
- - (<tt>Object</tt>) <strong>up_voter_ids</strong>
285
-
286
-
287
-
288
- </p><div class="docstring">
289
- <div class="discussion">
290
-
291
- <p>Array of up voter ids</p>
292
-
293
-
294
- </div>
295
- </div>
296
- <div class="tags">
297
-
298
- </div><table class="source_code">
299
- <tr>
300
- <td>
301
- <pre class="lines">
302
-
303
-
304
- 233
305
- 234
306
- 235</pre>
307
- </td>
308
- <td>
309
- <pre class="code"><span class="info file"># File 'lib/voteable_mongoid/voteable.rb', line 233</span>
310
-
311
- <span class='def def kw'>def</span> <span class='up_voter_ids identifier id'>up_voter_ids</span>
312
- <span class='voteable identifier id'>voteable</span><span class='dot token'>.</span><span class='try identifier id'>try</span><span class='lparen token'>(</span><span class='symbol val'>:[]</span><span class='comma token'>,</span> <span class='string val'>'up_voter_ids'</span><span class='rparen token'>)</span> <span class='orop op'>||</span> <span class='lbrack token'>[</span><span class='rbrack token'>]</span>
313
- <span class='end end kw'>end</span>
314
- </pre>
315
- </td>
316
- </tr>
317
- </table>
318
- </div>
319
-
320
- <div class="method_details ">
321
- <p class="signature " id="vote-instance_method">
322
-
323
- - (<tt>Object</tt>) <strong>vote</strong>(options)
324
-
325
-
326
-
327
- </p><div class="docstring">
328
- <div class="discussion">
329
-
330
- <p>Make a vote on this votee</p>
331
-
332
-
333
- </div>
334
- </div>
335
- <div class="tags">
336
- <h3>Parameters:</h3>
337
- <ul class="param">
338
-
339
- <li>
340
-
341
- <span class='type'>(<tt>Hash</tt>)</span>
342
-
343
-
344
- <span class='name'>options</span>
345
-
346
-
347
-
348
- &mdash;
349
- <div class='inline'>
350
- <p>a hash containings:</p>
351
- <ul><li>
352
- <p>:voter_id: the voter document id</p>
353
- </li><li>
354
- <p>:value: vote :up or vote :down</p>
355
- </li></ul>
356
- </div>
357
-
358
- </li>
359
-
360
- </ul>
361
-
362
- </div><table class="source_code">
363
- <tr>
364
- <td>
365
- <pre class="lines">
366
-
367
-
368
- 210
369
- 211
370
- 212
371
- 213
372
- 214
373
- 215
374
- 216
375
- 217
376
- 218
377
- 219
378
- 220
379
- 221</pre>
380
- </td>
381
- <td>
382
- <pre class="code"><span class="info file"># File 'lib/voteable_mongoid/voteable.rb', line 210</span>
383
-
384
- <span class='def def kw'>def</span> <span class='vote identifier id'>vote</span><span class='lparen token'>(</span><span class='options identifier id'>options</span><span class='rparen token'>)</span>
385
- <span class='options identifier id'>options</span><span class='lbrack token'>[</span><span class='symbol val'>:votee_id</span><span class='rbrack token'>]</span> <span class='opasgn op'>||=</span> <span class='_id identifier id'>_id</span>
386
- <span class='options identifier id'>options</span><span class='lbrack token'>[</span><span class='symbol val'>:votee</span><span class='rbrack token'>]</span> <span class='opasgn op'>||=</span> <span class='self self kw'>self</span>
387
-
388
- <span class='if if kw'>if</span> <span class='options identifier id'>options</span><span class='lbrack token'>[</span><span class='symbol val'>:unvote</span><span class='rbrack token'>]</span>
389
- <span class='options identifier id'>options</span><span class='lbrack token'>[</span><span class='symbol val'>:value</span><span class='rbrack token'>]</span> <span class='opasgn op'>||=</span> <span class='vote_value identifier id'>vote_value</span><span class='lparen token'>(</span><span class='options identifier id'>options</span><span class='lbrack token'>[</span><span class='symbol val'>:voter_id</span><span class='rbrack token'>]</span><span class='rparen token'>)</span>
390
- <span class='else else kw'>else</span>
391
- <span class='options identifier id'>options</span><span class='lbrack token'>[</span><span class='symbol val'>:revote</span><span class='rbrack token'>]</span> <span class='opasgn op'>||=</span> <span class='notop op'>!</span><span class='vote_value identifier id'>vote_value</span><span class='lparen token'>(</span><span class='options identifier id'>options</span><span class='lbrack token'>[</span><span class='symbol val'>:voter_id</span><span class='rbrack token'>]</span><span class='rparen token'>)</span><span class='dot token'>.</span><span class='nil? fid id'>nil?</span>
392
- <span class='end end kw'>end</span>
393
-
394
- <span class='self self kw'>self</span><span class='dot token'>.</span><span class='class identifier id'>class</span><span class='dot token'>.</span><span class='vote identifier id'>vote</span><span class='lparen token'>(</span><span class='options identifier id'>options</span><span class='rparen token'>)</span>
395
- <span class='end end kw'>end</span>
396
- </pre>
397
- </td>
398
- </tr>
399
- </table>
400
- </div>
401
-
402
- <div class="method_details ">
403
- <p class="signature " id="vote_value-instance_method">
404
-
405
- - (<tt>Object</tt>) <strong>vote_value</strong>(voter)
406
-
407
-
408
-
409
- </p><div class="docstring">
410
- <div class="discussion">
411
-
412
- <p>Get a voted value on this votee</p>
413
-
414
-
415
- </div>
416
- </div>
417
- <div class="tags">
418
- <h3>Parameters:</h3>
419
- <ul class="param">
420
-
421
- <li>
422
-
423
- <span class='type'>(<tt><span class='object_link'><a href="../Mongoid.html" title="Mongoid (module)">Mongoid</a></span> Object</tt>, <tt>BSON::ObjectId</tt>)</span>
424
-
425
-
426
- <span class='name'>voter</span>
427
-
428
-
429
-
430
- &mdash;
431
- <div class='inline'>
432
- <p>is Mongoid object the id of the voter who made the vote</p>
433
- </div>
434
-
435
- </li>
436
-
437
- </ul>
438
-
439
- </div><table class="source_code">
440
- <tr>
441
- <td>
442
- <pre class="lines">
443
-
444
-
445
- 226
446
- 227
447
- 228
448
- 229
449
- 230</pre>
450
- </td>
451
- <td>
452
- <pre class="code"><span class="info file"># File 'lib/voteable_mongoid/voteable.rb', line 226</span>
453
-
454
- <span class='def def kw'>def</span> <span class='vote_value identifier id'>vote_value</span><span class='lparen token'>(</span><span class='voter identifier id'>voter</span><span class='rparen token'>)</span>
455
- <span class='voter_id identifier id'>voter_id</span> <span class='assign token'>=</span> <span class='voter identifier id'>voter</span><span class='dot token'>.</span><span class='is_a? fid id'>is_a?</span><span class='lparen token'>(</span><span class='BSON constant id'>BSON</span><span class='colon2 op'>::</span><span class='ObjectId constant id'>ObjectId</span><span class='rparen token'>)</span> <span class='question op'>?</span> <span class='voter identifier id'>voter</span> <span class='colon op'>:</span> <span class='voter identifier id'>voter</span><span class='dot token'>.</span><span class='_id identifier id'>_id</span>
456
- <span class='return return kw'>return</span> <span class='symbol val'>:up</span> <span class='if if_mod kw'>if</span> <span class='up_voter_ids identifier id'>up_voter_ids</span><span class='dot token'>.</span><span class='include? fid id'>include?</span><span class='lparen token'>(</span><span class='voter_id identifier id'>voter_id</span><span class='rparen token'>)</span>
457
- <span class='return return kw'>return</span> <span class='symbol val'>:down</span> <span class='if if_mod kw'>if</span> <span class='down_voter_ids identifier id'>down_voter_ids</span><span class='dot token'>.</span><span class='include? fid id'>include?</span><span class='lparen token'>(</span><span class='voter_id identifier id'>voter_id</span><span class='rparen token'>)</span>
458
- <span class='end end kw'>end</span>
459
- </pre>
460
- </td>
461
- </tr>
462
- </table>
463
- </div>
464
-
465
- <div class="method_details ">
466
- <p class="signature " id="voteable-instance_method">
467
-
468
- - (<tt>Object</tt>) <strong>voteable</strong>
469
-
470
-
471
-
472
- </p><table class="source_code">
473
- <tr>
474
- <td>
475
- <pre class="lines">
476
-
477
-
478
- 242
479
- 243
480
- 244</pre>
481
- </td>
482
- <td>
483
- <pre class="code"><span class="info file"># File 'lib/voteable_mongoid/voteable.rb', line 242</span>
484
-
485
- <span class='def def kw'>def</span> <span class='voteable identifier id'>voteable</span>
486
- <span class='read_attribute identifier id'>read_attribute</span><span class='lparen token'>(</span><span class='string val'>'voteable'</span><span class='rparen token'>)</span>
487
- <span class='end end kw'>end</span>
488
- </pre>
489
- </td>
490
- </tr>
491
- </table>
492
- </div>
493
-
494
- </div>
495
-
496
- </div>
497
-
498
- <div id="footer">
499
- Generated on Wed Mar 30 22:06:28 2011 by
500
- <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
501
- 0.6.5 (ruby-1.8.7).
502
- </div>
503
-
504
- </body>
505
- </html>