applied a patch by mateusz jedruch <mateusz.jedruch@gmail.com> for iterating through...
[rubygit.git] / doc / classes / Git / Diff.html
blobae77da90e165010fe7075c6365e54c658af82f9f
1 <?xml version="1.0" encoding="iso-8859-1"?>
2 <!DOCTYPE html
3 PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
6 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7 <head>
8 <title>Class: Git::Diff</title>
9 <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10 <meta http-equiv="Content-Script-Type" content="text/javascript" />
11 <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
12 <script type="text/javascript">
13 // <![CDATA[
15 function popupCode( url ) {
16 window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
19 function toggleCode( id ) {
20 if ( document.getElementById )
21 elem = document.getElementById( id );
22 else if ( document.all )
23 elem = eval( "document.all." + id );
24 else
25 return false;
27 elemStyle = elem.style;
29 if ( elemStyle.display != "block" ) {
30 elemStyle.display = "block"
31 } else {
32 elemStyle.display = "none"
35 return true;
38 // Make codeblocks hidden by default
39 document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
41 // ]]>
42 </script>
44 </head>
45 <body>
49 <div id="classHeader">
50 <table class="header-table">
51 <tr class="top-aligned-row">
52 <td><strong>Class</strong></td>
53 <td class="class-name-in-header">Git::Diff</td>
54 </tr>
55 <tr class="top-aligned-row">
56 <td><strong>In:</strong></td>
57 <td>
58 <a href="../../files/lib/git/diff_rb.html">
59 lib/git/diff.rb
60 </a>
61 <br />
62 </td>
63 </tr>
65 <tr class="top-aligned-row">
66 <td><strong>Parent:</strong></td>
67 <td>
68 <a href="Object.html">
69 Object
70 </a>
71 </td>
72 </tr>
73 </table>
74 </div>
75 <!-- banner header -->
77 <div id="bodyContent">
81 <div id="contextContent">
83 <div id="description">
84 <p>
85 object that holds the last X commits on given branch
86 </p>
88 </div>
91 </div>
93 <div id="method-list">
94 <h3 class="section-bar">Methods</h3>
96 <div class="name-list">
97 <a href="#M000198">[]</a>&nbsp;&nbsp;
98 <a href="#M000193">deletions</a>&nbsp;&nbsp;
99 <a href="#M000199">each</a>&nbsp;&nbsp;
100 <a href="#M000194">insertions</a>&nbsp;&nbsp;
101 <a href="#M000192">lines</a>&nbsp;&nbsp;
102 <a href="#M000189">new</a>&nbsp;&nbsp;
103 <a href="#M000196">patch</a>&nbsp;&nbsp;
104 <a href="#M000190">path</a>&nbsp;&nbsp;
105 <a href="#M000191">size</a>&nbsp;&nbsp;
106 <a href="#M000195">stats</a>&nbsp;&nbsp;
107 <a href="#M000197">to_s</a>&nbsp;&nbsp;
108 </div>
109 </div>
111 </div>
114 <!-- if includes -->
115 <div id="includes">
116 <h3 class="section-bar">Included Modules</h3>
118 <div id="includes-list">
119 <span class="include-name">Enumerable</span>
120 </div>
121 </div>
123 <div id="section">
125 <div id="class-list">
126 <h3 class="section-bar">Classes and Modules</h3>
128 Class <a href="Diff/DiffFile.html" class="link">Git::Diff::DiffFile</a><br />
130 </div>
138 <!-- if method_list -->
139 <div id="methods">
140 <h3 class="section-bar">Public Class methods</h3>
142 <div id="method-M000189" class="method-detail">
143 <a name="M000189"></a>
145 <div class="method-heading">
146 <a href="#M000189" class="method-signature">
147 <span class="method-name">new</span><span class="method-args">(base, from = nil, to = nil)</span>
148 </a>
149 </div>
151 <div class="method-description">
152 <p><a class="source-toggle" href="#"
153 onclick="toggleCode('M000189-source');return false;">[Source]</a></p>
154 <div class="method-source-code" id="M000189-source">
155 <pre>
156 <span class="ruby-comment cmt"># File lib/git/diff.rb, line 16</span>
157 <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">base</span>, <span class="ruby-identifier">from</span> = <span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">to</span> = <span class="ruby-keyword kw">nil</span>)
158 <span class="ruby-ivar">@base</span> = <span class="ruby-identifier">base</span>
159 <span class="ruby-ivar">@from</span> = <span class="ruby-identifier">from</span>.<span class="ruby-identifier">to_s</span>
160 <span class="ruby-ivar">@to</span> = <span class="ruby-identifier">to</span>.<span class="ruby-identifier">to_s</span>
161 <span class="ruby-keyword kw">end</span>
162 </pre>
163 </div>
164 </div>
165 </div>
167 <h3 class="section-bar">Public Instance methods</h3>
169 <div id="method-M000198" class="method-detail">
170 <a name="M000198"></a>
172 <div class="method-heading">
173 <a href="#M000198" class="method-signature">
174 <span class="method-name">[]</span><span class="method-args">(key)</span>
175 </a>
176 </div>
178 <div class="method-description">
180 enumerable methods
181 </p>
182 <p><a class="source-toggle" href="#"
183 onclick="toggleCode('M000198-source');return false;">[Source]</a></p>
184 <div class="method-source-code" id="M000198-source">
185 <pre>
186 <span class="ruby-comment cmt"># File lib/git/diff.rb, line 61</span>
187 <span class="ruby-keyword kw">def</span> <span class="ruby-operator">[]</span>(<span class="ruby-identifier">key</span>)
188 <span class="ruby-identifier">process_full</span>
189 <span class="ruby-ivar">@full_diff_files</span>.<span class="ruby-identifier">assoc</span>(<span class="ruby-identifier">key</span>)[<span class="ruby-value">1</span>]
190 <span class="ruby-keyword kw">end</span>
191 </pre>
192 </div>
193 </div>
194 </div>
196 <div id="method-M000193" class="method-detail">
197 <a name="M000193"></a>
199 <div class="method-heading">
200 <a href="#M000193" class="method-signature">
201 <span class="method-name">deletions</span><span class="method-args">()</span>
202 </a>
203 </div>
205 <div class="method-description">
206 <p><a class="source-toggle" href="#"
207 onclick="toggleCode('M000193-source');return false;">[Source]</a></p>
208 <div class="method-source-code" id="M000193-source">
209 <pre>
210 <span class="ruby-comment cmt"># File lib/git/diff.rb, line 37</span>
211 <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">deletions</span>
212 <span class="ruby-identifier">cache_stats</span>
213 <span class="ruby-ivar">@stats</span>[<span class="ruby-identifier">:total</span>][<span class="ruby-identifier">:deletions</span>]
214 <span class="ruby-keyword kw">end</span>
215 </pre>
216 </div>
217 </div>
218 </div>
220 <div id="method-M000199" class="method-detail">
221 <a name="M000199"></a>
223 <div class="method-heading">
224 <a href="#M000199" class="method-signature">
225 <span class="method-name">each</span><span class="method-args">() {|file[1]| ...}</span>
226 </a>
227 </div>
229 <div class="method-description">
230 <p><a class="source-toggle" href="#"
231 onclick="toggleCode('M000199-source');return false;">[Source]</a></p>
232 <div class="method-source-code" id="M000199-source">
233 <pre>
234 <span class="ruby-comment cmt"># File lib/git/diff.rb, line 66</span>
235 <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">each</span>
236 <span class="ruby-identifier">process_full</span>
237 <span class="ruby-ivar">@full_diff_files</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">file</span><span class="ruby-operator">|</span>
238 <span class="ruby-keyword kw">yield</span> <span class="ruby-identifier">file</span>[<span class="ruby-value">1</span>]
239 <span class="ruby-keyword kw">end</span>
240 <span class="ruby-keyword kw">end</span>
241 </pre>
242 </div>
243 </div>
244 </div>
246 <div id="method-M000194" class="method-detail">
247 <a name="M000194"></a>
249 <div class="method-heading">
250 <a href="#M000194" class="method-signature">
251 <span class="method-name">insertions</span><span class="method-args">()</span>
252 </a>
253 </div>
255 <div class="method-description">
256 <p><a class="source-toggle" href="#"
257 onclick="toggleCode('M000194-source');return false;">[Source]</a></p>
258 <div class="method-source-code" id="M000194-source">
259 <pre>
260 <span class="ruby-comment cmt"># File lib/git/diff.rb, line 42</span>
261 <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">insertions</span>
262 <span class="ruby-identifier">cache_stats</span>
263 <span class="ruby-ivar">@stats</span>[<span class="ruby-identifier">:total</span>][<span class="ruby-identifier">:insertions</span>]
264 <span class="ruby-keyword kw">end</span>
265 </pre>
266 </div>
267 </div>
268 </div>
270 <div id="method-M000192" class="method-detail">
271 <a name="M000192"></a>
273 <div class="method-heading">
274 <a href="#M000192" class="method-signature">
275 <span class="method-name">lines</span><span class="method-args">()</span>
276 </a>
277 </div>
279 <div class="method-description">
280 <p><a class="source-toggle" href="#"
281 onclick="toggleCode('M000192-source');return false;">[Source]</a></p>
282 <div class="method-source-code" id="M000192-source">
283 <pre>
284 <span class="ruby-comment cmt"># File lib/git/diff.rb, line 32</span>
285 <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">lines</span>
286 <span class="ruby-identifier">cache_stats</span>
287 <span class="ruby-ivar">@stats</span>[<span class="ruby-identifier">:total</span>][<span class="ruby-identifier">:lines</span>]
288 <span class="ruby-keyword kw">end</span>
289 </pre>
290 </div>
291 </div>
292 </div>
294 <div id="method-M000196" class="method-detail">
295 <a name="M000196"></a>
297 <div class="method-heading">
298 <a href="#M000196" class="method-signature">
299 <span class="method-name">patch</span><span class="method-args">(file = nil)</span>
300 </a>
301 </div>
303 <div class="method-description">
305 if file is provided and is writable, it will write the patch into the file
306 </p>
307 <p><a class="source-toggle" href="#"
308 onclick="toggleCode('M000196-source');return false;">[Source]</a></p>
309 <div class="method-source-code" id="M000196-source">
310 <pre>
311 <span class="ruby-comment cmt"># File lib/git/diff.rb, line 53</span>
312 <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">patch</span>(<span class="ruby-identifier">file</span> = <span class="ruby-keyword kw">nil</span>)
313 <span class="ruby-identifier">cache_full</span>
314 <span class="ruby-ivar">@full_diff</span>
315 <span class="ruby-keyword kw">end</span>
316 </pre>
317 </div>
318 </div>
319 </div>
321 <div id="method-M000190" class="method-detail">
322 <a name="M000190"></a>
324 <div class="method-heading">
325 <a href="#M000190" class="method-signature">
326 <span class="method-name">path</span><span class="method-args">(path)</span>
327 </a>
328 </div>
330 <div class="method-description">
331 <p><a class="source-toggle" href="#"
332 onclick="toggleCode('M000190-source');return false;">[Source]</a></p>
333 <div class="method-source-code" id="M000190-source">
334 <pre>
335 <span class="ruby-comment cmt"># File lib/git/diff.rb, line 22</span>
336 <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">path</span>(<span class="ruby-identifier">path</span>)
337 <span class="ruby-ivar">@path</span> = <span class="ruby-identifier">path</span>
338 <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">self</span>
339 <span class="ruby-keyword kw">end</span>
340 </pre>
341 </div>
342 </div>
343 </div>
345 <div id="method-M000191" class="method-detail">
346 <a name="M000191"></a>
348 <div class="method-heading">
349 <a href="#M000191" class="method-signature">
350 <span class="method-name">size</span><span class="method-args">()</span>
351 </a>
352 </div>
354 <div class="method-description">
355 <p><a class="source-toggle" href="#"
356 onclick="toggleCode('M000191-source');return false;">[Source]</a></p>
357 <div class="method-source-code" id="M000191-source">
358 <pre>
359 <span class="ruby-comment cmt"># File lib/git/diff.rb, line 27</span>
360 <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">size</span>
361 <span class="ruby-identifier">cache_stats</span>
362 <span class="ruby-ivar">@stats</span>[<span class="ruby-identifier">:total</span>][<span class="ruby-identifier">:files</span>]
363 <span class="ruby-keyword kw">end</span>
364 </pre>
365 </div>
366 </div>
367 </div>
369 <div id="method-M000195" class="method-detail">
370 <a name="M000195"></a>
372 <div class="method-heading">
373 <a href="#M000195" class="method-signature">
374 <span class="method-name">stats</span><span class="method-args">()</span>
375 </a>
376 </div>
378 <div class="method-description">
379 <p><a class="source-toggle" href="#"
380 onclick="toggleCode('M000195-source');return false;">[Source]</a></p>
381 <div class="method-source-code" id="M000195-source">
382 <pre>
383 <span class="ruby-comment cmt"># File lib/git/diff.rb, line 47</span>
384 <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">stats</span>
385 <span class="ruby-identifier">cache_stats</span>
386 <span class="ruby-ivar">@stats</span>
387 <span class="ruby-keyword kw">end</span>
388 </pre>
389 </div>
390 </div>
391 </div>
393 <div id="method-M000197" class="method-detail">
394 <a name="M000197"></a>
396 <div class="method-heading">
397 <span class="method-name">to_s</span><span class="method-args">(file = nil)</span>
398 </div>
400 <div class="method-description">
402 Alias for <a href="Diff.html#M000196">patch</a>
403 </p>
404 </div>
405 </div>
408 </div>
411 </div>
414 <div id="validator-badges">
415 <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
416 </div>
418 </body>
419 </html>