OSDN Git Service

Merge commit 'master' into discussions
[wvm/gitlab.git] / doc / code / classes / Votes.html
1 <?xml version="1.0" encoding="utf-8"?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
3     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
4 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5 <head>
6     <title>Votes</title>
7     <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
8     <link rel="stylesheet" href="../css/reset.css" type="text/css" media="screen" />
9 <link rel="stylesheet" href="../css/main.css" type="text/css" media="screen" />
10 <link rel="stylesheet" href="../css/github.css" type="text/css" media="screen" />
11 <script src="../js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
12 <script src="../js/jquery-effect.js" type="text/javascript" charset="utf-8"></script>
13 <script src="../js/main.js" type="text/javascript" charset="utf-8"></script>
14 <script src="../js/highlight.pack.js" type="text/javascript" charset="utf-8"></script>
15
16 </head>
17
18 <body>     
19     <div class="banner">
20         
21         <h1>
22             <span class="type">Module</span> 
23             Votes 
24             
25         </h1>
26         <ul class="files">
27             
28             <li><a href="../files/app/roles/votes_rb.html">app/roles/votes.rb</a></li>
29             
30         </ul>
31     </div>
32     <div id="bodyContent">
33         <div id="content">
34   
35
36
37   
38
39
40   
41   
42
43
44   
45
46
47   
48     <!-- Method ref -->
49     <div class="sectiontitle">Methods</div>
50     <dl class="methods">
51       
52         <dt>D</dt>
53         <dd>
54           <ul>
55             
56               
57               <li>
58                 <a href="#method-i-downvotes">downvotes</a>,
59               </li>
60             
61               
62               <li>
63                 <a href="#method-i-downvotes_in_percent">downvotes_in_percent</a>
64               </li>
65             
66           </ul>
67         </dd>
68       
69         <dt>U</dt>
70         <dd>
71           <ul>
72             
73               
74               <li>
75                 <a href="#method-i-upvotes">upvotes</a>,
76               </li>
77             
78               
79               <li>
80                 <a href="#method-i-upvotes_in_percent">upvotes_in_percent</a>
81               </li>
82             
83           </ul>
84         </dd>
85       
86         <dt>V</dt>
87         <dd>
88           <ul>
89             
90               
91               <li>
92                 <a href="#method-i-votes_count">votes_count</a>
93               </li>
94             
95           </ul>
96         </dd>
97       
98     </dl>
99   
100
101   
102
103
104
105   
106
107     
108
109     
110
111     
112
113
114     
115
116
117     <!-- Methods -->
118         
119       <div class="sectiontitle">Instance Public methods</div>
120       
121         <div class="method">
122           <div class="title method-title" id="method-i-downvotes">
123             
124               <b>downvotes</b>()
125             
126             <a href="../classes/Votes.html#method-i-downvotes" name="method-i-downvotes" class="permalink">Link</a>
127           </div>
128           
129           
130             <div class="description">
131               <p>Return the number of -1 comments (downvotes)</p>
132             </div>
133           
134           
135           
136           
137           
138             
139             <div class="sourcecode">
140               
141               <p class="source-link">
142                 Source: 
143                 <a href="javascript:toggleSource('method-i-downvotes_source')" id="l_method-i-downvotes_source">show</a>
144                 
145               </p>
146               <div id="method-i-downvotes_source" class="dyn-source">
147                 <pre><span class="ruby-comment"># File app/roles/votes.rb, line 16</span>
148 <span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">downvotes</span>
149   <span class="ruby-identifier">notes</span>.<span class="ruby-identifier">select</span>(&amp;<span class="ruby-value">:downvote?</span>).<span class="ruby-identifier">size</span>
150 <span class="ruby-keyword">end</span></pre>
151               </div>
152             </div>
153             
154           </div>
155         
156         <div class="method">
157           <div class="title method-title" id="method-i-downvotes_in_percent">
158             
159               <b>downvotes_in_percent</b>()
160             
161             <a href="../classes/Votes.html#method-i-downvotes_in_percent" name="method-i-downvotes_in_percent" class="permalink">Link</a>
162           </div>
163           
164           
165             <div class="description">
166               
167             </div>
168           
169           
170           
171           
172           
173             
174             <div class="sourcecode">
175               
176               <p class="source-link">
177                 Source: 
178                 <a href="javascript:toggleSource('method-i-downvotes_in_percent_source')" id="l_method-i-downvotes_in_percent_source">show</a>
179                 
180               </p>
181               <div id="method-i-downvotes_in_percent_source" class="dyn-source">
182                 <pre><span class="ruby-comment"># File app/roles/votes.rb, line 20</span>
183 <span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">downvotes_in_percent</span>
184   <span class="ruby-keyword">if</span> <span class="ruby-identifier">votes_count</span>.<span class="ruby-identifier">zero?</span>
185     <span class="ruby-number">0</span>
186   <span class="ruby-keyword">else</span>
187     <span class="ruby-number">100.0</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">upvotes_in_percent</span>
188   <span class="ruby-keyword">end</span>
189 <span class="ruby-keyword">end</span></pre>
190               </div>
191             </div>
192             
193           </div>
194         
195         <div class="method">
196           <div class="title method-title" id="method-i-upvotes">
197             
198               <b>upvotes</b>()
199             
200             <a href="../classes/Votes.html#method-i-upvotes" name="method-i-upvotes" class="permalink">Link</a>
201           </div>
202           
203           
204             <div class="description">
205               <p>Return the number of +1 comments (upvotes)</p>
206             </div>
207           
208           
209           
210           
211           
212             
213             <div class="sourcecode">
214               
215               <p class="source-link">
216                 Source: 
217                 <a href="javascript:toggleSource('method-i-upvotes_source')" id="l_method-i-upvotes_source">show</a>
218                 
219               </p>
220               <div id="method-i-upvotes_source" class="dyn-source">
221                 <pre><span class="ruby-comment"># File app/roles/votes.rb, line 3</span>
222 <span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">upvotes</span>
223   <span class="ruby-identifier">notes</span>.<span class="ruby-identifier">select</span>(&amp;<span class="ruby-value">:upvote?</span>).<span class="ruby-identifier">size</span>
224 <span class="ruby-keyword">end</span></pre>
225               </div>
226             </div>
227             
228           </div>
229         
230         <div class="method">
231           <div class="title method-title" id="method-i-upvotes_in_percent">
232             
233               <b>upvotes_in_percent</b>()
234             
235             <a href="../classes/Votes.html#method-i-upvotes_in_percent" name="method-i-upvotes_in_percent" class="permalink">Link</a>
236           </div>
237           
238           
239             <div class="description">
240               
241             </div>
242           
243           
244           
245           
246           
247             
248             <div class="sourcecode">
249               
250               <p class="source-link">
251                 Source: 
252                 <a href="javascript:toggleSource('method-i-upvotes_in_percent_source')" id="l_method-i-upvotes_in_percent_source">show</a>
253                 
254               </p>
255               <div id="method-i-upvotes_in_percent_source" class="dyn-source">
256                 <pre><span class="ruby-comment"># File app/roles/votes.rb, line 7</span>
257 <span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">upvotes_in_percent</span>
258   <span class="ruby-keyword">if</span> <span class="ruby-identifier">votes_count</span>.<span class="ruby-identifier">zero?</span>
259     <span class="ruby-number">0</span>
260   <span class="ruby-keyword">else</span>
261     <span class="ruby-number">100.0</span> <span class="ruby-operator">/</span> <span class="ruby-identifier">votes_count</span> * <span class="ruby-identifier">upvotes</span>
262   <span class="ruby-keyword">end</span>
263 <span class="ruby-keyword">end</span></pre>
264               </div>
265             </div>
266             
267           </div>
268         
269         <div class="method">
270           <div class="title method-title" id="method-i-votes_count">
271             
272               <b>votes_count</b>()
273             
274             <a href="../classes/Votes.html#method-i-votes_count" name="method-i-votes_count" class="permalink">Link</a>
275           </div>
276           
277           
278             <div class="description">
279               <p>Return the total number of votes</p>
280             </div>
281           
282           
283           
284           
285           
286             
287             <div class="sourcecode">
288               
289               <p class="source-link">
290                 Source: 
291                 <a href="javascript:toggleSource('method-i-votes_count_source')" id="l_method-i-votes_count_source">show</a>
292                 
293               </p>
294               <div id="method-i-votes_count_source" class="dyn-source">
295                 <pre><span class="ruby-comment"># File app/roles/votes.rb, line 29</span>
296 <span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">votes_count</span>
297   <span class="ruby-identifier">upvotes</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">downvotes</span>
298 <span class="ruby-keyword">end</span></pre>
299               </div>
300             </div>
301             
302           </div>
303                     </div>
304
305     </div>
306   </body>
307 </html>