sprout 1.1.11.pre → 1.1.13.pre
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of sprout might be problematic. Click here for more details.
- data/Gemfile.lock +3 -4
- data/VERSION +1 -1
- data/doc/Dir.html +288 -0
- data/doc/Rake/Task.html +184 -0
- data/doc/Sprout.html +740 -0
- data/doc/Sprout/ArchiveUnpacker.html +1246 -0
- data/doc/Sprout/CommandLine.html +520 -0
- data/doc/Sprout/Concern.html +351 -0
- data/doc/Sprout/Errors.html +101 -0
- data/doc/Sprout/Errors/ArchiveUnpackerError.html +125 -0
- data/doc/Sprout/Errors/DestinationExistsError.html +133 -0
- data/doc/Sprout/Errors/DuplicateMemberError.html +132 -0
- data/doc/Sprout/Errors/ExecutableError.html +125 -0
- data/doc/Sprout/Errors/ExecutableRegistrationError.html +132 -0
- data/doc/Sprout/Errors/ExecutionError.html +121 -0
- data/doc/Sprout/Errors/GeneratorError.html +125 -0
- data/doc/Sprout/Errors/InvalidArgumentError.html +132 -0
- data/doc/Sprout/Errors/LoadError.html +121 -0
- data/doc/Sprout/Errors/MissingArgumentError.html +132 -0
- data/doc/Sprout/Errors/MissingExecutableError.html +132 -0
- data/doc/Sprout/Errors/MissingGeneratorError.html +132 -0
- data/doc/Sprout/Errors/MissingTemplateError.html +132 -0
- data/doc/Sprout/Errors/ProcessRunnerError.html +121 -0
- data/doc/Sprout/Errors/RemoteFileLoaderError.html +110 -0
- data/doc/Sprout/Errors/SproutError.html +114 -0
- data/doc/Sprout/Errors/UnknownArchiveType.html +122 -0
- data/doc/Sprout/Errors/UsageError.html +121 -0
- data/doc/Sprout/Errors/ValidationError.html +121 -0
- data/doc/Sprout/Errors/VersionRequirementNotMetError.html +121 -0
- data/doc/Sprout/Executable.html +169 -0
- data/doc/Sprout/Executable/Base.html +2813 -0
- data/doc/Sprout/Executable/Boolean.html +534 -0
- data/doc/Sprout/Executable/CollectionParam.html +483 -0
- data/doc/Sprout/Executable/FileParam.html +484 -0
- data/doc/Sprout/Executable/Files.html +292 -0
- data/doc/Sprout/Executable/Number.html +141 -0
- data/doc/Sprout/Executable/Param.html +2874 -0
- data/doc/Sprout/Executable/ParameterFactory.html +232 -0
- data/doc/Sprout/Executable/Path.html +223 -0
- data/doc/Sprout/Executable/Paths.html +253 -0
- data/doc/Sprout/Executable/Session.html +1513 -0
- data/doc/Sprout/Executable/StringParam.html +213 -0
- data/doc/Sprout/Executable/Strings.html +167 -0
- data/doc/Sprout/Executable/Url.html +160 -0
- data/doc/Sprout/Executable/Urls.html +170 -0
- data/doc/Sprout/FileTarget.html +1109 -0
- data/doc/Sprout/Generator.html +750 -0
- data/doc/Sprout/Generator/Base.html +1902 -0
- data/doc/Sprout/Generator/Command.html +690 -0
- data/doc/Sprout/Generator/DirectoryManifest.html +476 -0
- data/doc/Sprout/Generator/FileManifest.html +643 -0
- data/doc/Sprout/Generator/Manifest.html +377 -0
- data/doc/Sprout/Generator/TemplateManifest.html +194 -0
- data/doc/Sprout/GeneratorGenerator.html +1115 -0
- data/doc/Sprout/Library.html +1146 -0
- data/doc/Sprout/LibraryGenerator.html +331 -0
- data/doc/Sprout/OutputBuffer.html +445 -0
- data/doc/Sprout/Platform.html +714 -0
- data/doc/Sprout/ProcessRunner.html +1707 -0
- data/doc/Sprout/ProgressBar.html +366 -0
- data/doc/Sprout/ProgressBarImpl.html +2109 -0
- data/doc/Sprout/ProgressBarManager.html +424 -0
- data/doc/Sprout/ProgressBarOutputStream.html +406 -0
- data/doc/Sprout/RDocParser.html +211 -0
- data/doc/Sprout/RemoteFileLoader.html +172 -0
- data/doc/Sprout/RemoteFileTarget.html +679 -0
- data/doc/Sprout/ReversedProgressBar.html +184 -0
- data/doc/Sprout/RubyFeature.html +155 -0
- data/doc/Sprout/RubyFeature/ClassMethods.html +1065 -0
- data/doc/Sprout/RubyGenerator.html +786 -0
- data/doc/Sprout/Specification.html +767 -0
- data/doc/Sprout/System.html +191 -0
- data/doc/Sprout/System/BaseSystem.html +1660 -0
- data/doc/Sprout/System/JavaSystem.html +122 -0
- data/doc/Sprout/System/OSXSystem.html +335 -0
- data/doc/Sprout/System/ThreadMock.html +183 -0
- data/doc/Sprout/System/UnixSystem.html +584 -0
- data/doc/Sprout/System/VistaSystem.html +251 -0
- data/doc/Sprout/System/WinNixSystem.html +325 -0
- data/doc/Sprout/System/WinSystem.html +571 -0
- data/doc/Sprout/TestHelper.html +2165 -0
- data/doc/Sprout/ToolGenerator.html +953 -0
- data/doc/Sprout/VERSION.html +118 -0
- data/doc/String.html +290 -0
- data/doc/_index.html +820 -0
- data/doc/class_list.html +36 -0
- data/doc/css/common.css +1 -0
- data/doc/css/full_list.css +53 -0
- data/doc/css/style.css +310 -0
- data/doc/file.README.html +96 -0
- data/doc/file_list.html +41 -0
- data/doc/frames.html +13 -0
- data/doc/index.html +96 -0
- data/doc/js/app.js +202 -0
- data/doc/js/full_list.js +149 -0
- data/doc/js/jquery.js +154 -0
- data/doc/method_list.html +3603 -0
- data/doc/top-level-namespace.html +192 -0
- data/lib/sprout.rb +1 -0
- data/lib/sprout/executable/base.rb +2 -5
- data/lib/sprout/executable/param.rb +15 -8
- data/lib/sprout/executable/session.rb +1 -1
- data/lib/sprout/library.rb +44 -2
- data/test/unit/executable_test.rb +3 -5
- metadata +99 -3
@@ -0,0 +1,366 @@
|
|
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 name="Content-Type" content="text/html; charset=utf-8" />
|
6
|
+
<title>Class: Sprout::ProgressBar</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 (P)</a> »
|
27
|
+
<span class='title'><span class='object_link'><a href="../Sprout.html" title="Sprout (module)">Sprout</a></span></span>
|
28
|
+
»
|
29
|
+
<span class="title">ProgressBar</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>Class: Sprout::ProgressBar
|
47
|
+
|
48
|
+
|
49
|
+
|
50
|
+
</h1>
|
51
|
+
|
52
|
+
<dl class="box">
|
53
|
+
|
54
|
+
<dt class="r1">Inherits:</dt>
|
55
|
+
<dd class="r1">
|
56
|
+
<span class="inheritName">Object</span>
|
57
|
+
|
58
|
+
<ul class="fullTree">
|
59
|
+
<li>Object</li>
|
60
|
+
|
61
|
+
<li class="next">Sprout::ProgressBar</li>
|
62
|
+
|
63
|
+
</ul>
|
64
|
+
<a href="#" class="inheritanceTree">show all</a>
|
65
|
+
|
66
|
+
</dd>
|
67
|
+
|
68
|
+
|
69
|
+
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
|
74
|
+
|
75
|
+
|
76
|
+
<dt class="r2 last">Defined in:</dt>
|
77
|
+
<dd class="r2 last">lib/sprout/progress_bar.rb</dd>
|
78
|
+
|
79
|
+
</dl>
|
80
|
+
<div class="clear"></div>
|
81
|
+
|
82
|
+
<div id="subclasses">
|
83
|
+
<h2>Direct Known Subclasses</h2>
|
84
|
+
<p class="children"><span class='object_link'><a href="ReversedProgressBar.html" title="Sprout::ReversedProgressBar (class)">ReversedProgressBar</a></span></p>
|
85
|
+
</div>
|
86
|
+
|
87
|
+
<h2>Constant Summary</h2>
|
88
|
+
|
89
|
+
<dl class="constants">
|
90
|
+
|
91
|
+
<dt id="VERSION-constant" class="">VERSION =
|
92
|
+
|
93
|
+
</dt>
|
94
|
+
<dd><pre class="code"><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>0.9</span><span class='tstring_end'>"</span></span></pre></dd>
|
95
|
+
|
96
|
+
<dt id="debug-classvariable" class="">@@debug =
|
97
|
+
|
98
|
+
</dt>
|
99
|
+
<dd><pre class="code"><span class='kw'>false</span></pre></dd>
|
100
|
+
|
101
|
+
<dt id="outio-classvariable" class="">@@outio =
|
102
|
+
|
103
|
+
</dt>
|
104
|
+
<dd><pre class="code"><span class='gvar'>$stderr</span></pre></dd>
|
105
|
+
|
106
|
+
</dl>
|
107
|
+
|
108
|
+
|
109
|
+
|
110
|
+
|
111
|
+
|
112
|
+
<h2>
|
113
|
+
Class 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="#debug%3D-class_method" title="debug= (class method)">+ (Object) <strong>debug=</strong>(debug) </a>
|
123
|
+
|
124
|
+
|
125
|
+
|
126
|
+
</span>
|
127
|
+
|
128
|
+
|
129
|
+
|
130
|
+
|
131
|
+
|
132
|
+
|
133
|
+
|
134
|
+
|
135
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
136
|
+
|
137
|
+
</li>
|
138
|
+
|
139
|
+
|
140
|
+
<li class="public ">
|
141
|
+
<span class="summary_signature">
|
142
|
+
|
143
|
+
<a href="#debug%3F-class_method" title="debug? (class method)">+ (Boolean) <strong>debug?</strong> </a>
|
144
|
+
|
145
|
+
|
146
|
+
|
147
|
+
</span>
|
148
|
+
|
149
|
+
|
150
|
+
|
151
|
+
|
152
|
+
|
153
|
+
|
154
|
+
|
155
|
+
|
156
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
157
|
+
|
158
|
+
</li>
|
159
|
+
|
160
|
+
|
161
|
+
<li class="public ">
|
162
|
+
<span class="summary_signature">
|
163
|
+
|
164
|
+
<a href="#new-class_method" title="new (class method)">+ (Object) <strong>new</strong>(title, total) </a>
|
165
|
+
|
166
|
+
|
167
|
+
|
168
|
+
</span>
|
169
|
+
|
170
|
+
|
171
|
+
|
172
|
+
|
173
|
+
|
174
|
+
|
175
|
+
|
176
|
+
|
177
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
178
|
+
|
179
|
+
</li>
|
180
|
+
|
181
|
+
|
182
|
+
<li class="public ">
|
183
|
+
<span class="summary_signature">
|
184
|
+
|
185
|
+
<a href="#outio-class_method" title="outio (class method)">+ (Object) <strong>outio</strong> </a>
|
186
|
+
|
187
|
+
|
188
|
+
|
189
|
+
</span>
|
190
|
+
|
191
|
+
|
192
|
+
|
193
|
+
|
194
|
+
|
195
|
+
|
196
|
+
|
197
|
+
|
198
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
199
|
+
|
200
|
+
</li>
|
201
|
+
|
202
|
+
|
203
|
+
</ul>
|
204
|
+
|
205
|
+
|
206
|
+
|
207
|
+
|
208
|
+
<div id="class_method_details" class="method_details_list">
|
209
|
+
<h2>Class Method Details</h2>
|
210
|
+
|
211
|
+
|
212
|
+
<div class="method_details first">
|
213
|
+
<p class="signature first" id="debug=-class_method">
|
214
|
+
|
215
|
+
+ (<tt>Object</tt>) <strong>debug=</strong>(debug)
|
216
|
+
|
217
|
+
|
218
|
+
|
219
|
+
</p><table class="source_code">
|
220
|
+
<tr>
|
221
|
+
<td>
|
222
|
+
<pre class="lines">
|
223
|
+
|
224
|
+
|
225
|
+
29
|
226
|
+
30
|
227
|
+
31
|
228
|
+
32
|
229
|
+
33
|
230
|
+
34
|
231
|
+
35
|
232
|
+
36</pre>
|
233
|
+
</td>
|
234
|
+
<td>
|
235
|
+
<pre class="code"><span class="info file"># File 'lib/sprout/progress_bar.rb', line 29</span>
|
236
|
+
|
237
|
+
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id debug='>debug=</span><span class='lparen'>(</span><span class='id debug'>debug</span><span class='rparen'>)</span>
|
238
|
+
<span class='cvar'>@@debug</span> <span class='op'>=</span> <span class='id debug'>debug</span>
|
239
|
+
<span class='kw'>if</span><span class='lparen'>(</span><span class='id debug'>debug</span><span class='rparen'>)</span>
|
240
|
+
<span class='cvar'>@@outio</span> <span class='op'>=</span> <span class='const'>StringIO</span><span class='period'>.</span><span class='id new'>new</span>
|
241
|
+
<span class='kw'>else</span>
|
242
|
+
<span class='cvar'>@@outio</span> <span class='op'>=</span> <span class='gvar'>$stderr</span>
|
243
|
+
<span class='kw'>end</span>
|
244
|
+
<span class='kw'>end</span></pre>
|
245
|
+
</td>
|
246
|
+
</tr>
|
247
|
+
</table>
|
248
|
+
</div>
|
249
|
+
|
250
|
+
<div class="method_details ">
|
251
|
+
<p class="signature " id="debug?-class_method">
|
252
|
+
|
253
|
+
+ (<tt>Boolean</tt>) <strong>debug?</strong>
|
254
|
+
|
255
|
+
|
256
|
+
|
257
|
+
</p><div class="docstring">
|
258
|
+
<div class="discussion">
|
259
|
+
|
260
|
+
|
261
|
+
</div>
|
262
|
+
</div>
|
263
|
+
<div class="tags">
|
264
|
+
<h3>Returns:</h3>
|
265
|
+
<ul class="return">
|
266
|
+
|
267
|
+
<li>
|
268
|
+
|
269
|
+
<span class='type'>(<tt>Boolean</tt>)</span>
|
270
|
+
|
271
|
+
|
272
|
+
|
273
|
+
|
274
|
+
</li>
|
275
|
+
|
276
|
+
</ul>
|
277
|
+
|
278
|
+
</div><table class="source_code">
|
279
|
+
<tr>
|
280
|
+
<td>
|
281
|
+
<pre class="lines">
|
282
|
+
|
283
|
+
|
284
|
+
25
|
285
|
+
26
|
286
|
+
27</pre>
|
287
|
+
</td>
|
288
|
+
<td>
|
289
|
+
<pre class="code"><span class="info file"># File 'lib/sprout/progress_bar.rb', line 25</span>
|
290
|
+
|
291
|
+
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id debug?'>debug?</span>
|
292
|
+
<span class='cvar'>@@debug</span>
|
293
|
+
<span class='kw'>end</span></pre>
|
294
|
+
</td>
|
295
|
+
</tr>
|
296
|
+
</table>
|
297
|
+
</div>
|
298
|
+
|
299
|
+
<div class="method_details ">
|
300
|
+
<p class="signature " id="new-class_method">
|
301
|
+
|
302
|
+
+ (<tt>Object</tt>) <strong>new</strong>(title, total)
|
303
|
+
|
304
|
+
|
305
|
+
|
306
|
+
</p><table class="source_code">
|
307
|
+
<tr>
|
308
|
+
<td>
|
309
|
+
<pre class="lines">
|
310
|
+
|
311
|
+
|
312
|
+
21
|
313
|
+
22
|
314
|
+
23</pre>
|
315
|
+
</td>
|
316
|
+
<td>
|
317
|
+
<pre class="code"><span class="info file"># File 'lib/sprout/progress_bar.rb', line 21</span>
|
318
|
+
|
319
|
+
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id new'>new</span><span class='lparen'>(</span><span class='id title'>title</span><span class='comma'>,</span> <span class='id total'>total</span><span class='rparen'>)</span>
|
320
|
+
<span class='kw'>return</span> <span class='const'>ProgressBarManager</span><span class='period'>.</span><span class='id instance'>instance</span><span class='period'>.</span><span class='id add'>add</span><span class='lparen'>(</span><span class='id title'>title</span><span class='comma'>,</span> <span class='id total'>total</span><span class='rparen'>)</span>
|
321
|
+
<span class='kw'>end</span></pre>
|
322
|
+
</td>
|
323
|
+
</tr>
|
324
|
+
</table>
|
325
|
+
</div>
|
326
|
+
|
327
|
+
<div class="method_details ">
|
328
|
+
<p class="signature " id="outio-class_method">
|
329
|
+
|
330
|
+
+ (<tt>Object</tt>) <strong>outio</strong>
|
331
|
+
|
332
|
+
|
333
|
+
|
334
|
+
</p><table class="source_code">
|
335
|
+
<tr>
|
336
|
+
<td>
|
337
|
+
<pre class="lines">
|
338
|
+
|
339
|
+
|
340
|
+
38
|
341
|
+
39
|
342
|
+
40</pre>
|
343
|
+
</td>
|
344
|
+
<td>
|
345
|
+
<pre class="code"><span class="info file"># File 'lib/sprout/progress_bar.rb', line 38</span>
|
346
|
+
|
347
|
+
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id outio'>outio</span>
|
348
|
+
<span class='cvar'>@@outio</span>
|
349
|
+
<span class='kw'>end</span></pre>
|
350
|
+
</td>
|
351
|
+
</tr>
|
352
|
+
</table>
|
353
|
+
</div>
|
354
|
+
|
355
|
+
</div>
|
356
|
+
|
357
|
+
</div>
|
358
|
+
|
359
|
+
<div id="footer">
|
360
|
+
Generated on Fri Apr 29 18:33:06 2011 by
|
361
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
362
|
+
0.6.3 (ruby-1.9.2).
|
363
|
+
</div>
|
364
|
+
|
365
|
+
</body>
|
366
|
+
</html>
|
@@ -0,0 +1,2109 @@
|
|
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 name="Content-Type" content="text/html; charset=utf-8" />
|
6
|
+
<title>Class: Sprout::ProgressBarImpl</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 (P)</a> »
|
27
|
+
<span class='title'><span class='object_link'><a href="../Sprout.html" title="Sprout (module)">Sprout</a></span></span>
|
28
|
+
»
|
29
|
+
<span class="title">ProgressBarImpl</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>Class: Sprout::ProgressBarImpl
|
47
|
+
|
48
|
+
|
49
|
+
|
50
|
+
</h1>
|
51
|
+
|
52
|
+
<dl class="box">
|
53
|
+
|
54
|
+
<dt class="r1">Inherits:</dt>
|
55
|
+
<dd class="r1">
|
56
|
+
<span class="inheritName">Object</span>
|
57
|
+
|
58
|
+
<ul class="fullTree">
|
59
|
+
<li>Object</li>
|
60
|
+
|
61
|
+
<li class="next">Sprout::ProgressBarImpl</li>
|
62
|
+
|
63
|
+
</ul>
|
64
|
+
<a href="#" class="inheritanceTree">show all</a>
|
65
|
+
|
66
|
+
</dd>
|
67
|
+
|
68
|
+
|
69
|
+
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
|
74
|
+
|
75
|
+
|
76
|
+
<dt class="r2 last">Defined in:</dt>
|
77
|
+
<dd class="r2 last">lib/sprout/progress_bar.rb</dd>
|
78
|
+
|
79
|
+
</dl>
|
80
|
+
<div class="clear"></div>
|
81
|
+
|
82
|
+
|
83
|
+
|
84
|
+
<h2>Instance Attribute Summary <small>(<a href="#" class="summary_toggle">collapse</a>)</small></h2>
|
85
|
+
<ul class="summary">
|
86
|
+
|
87
|
+
<li class="public ">
|
88
|
+
<span class="summary_signature">
|
89
|
+
|
90
|
+
<a href="#bar_mark-instance_method" title="#bar_mark (instance method)">- (Object) <strong>bar_mark</strong> </a>
|
91
|
+
|
92
|
+
|
93
|
+
|
94
|
+
</span>
|
95
|
+
|
96
|
+
|
97
|
+
|
98
|
+
|
99
|
+
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
|
106
|
+
<span class="summary_desc"><div class='inline'>
|
107
|
+
<p>Returns the value of attribute bar_mark.</p>
|
108
|
+
</div></span>
|
109
|
+
|
110
|
+
</li>
|
111
|
+
|
112
|
+
|
113
|
+
<li class="public ">
|
114
|
+
<span class="summary_signature">
|
115
|
+
|
116
|
+
<a href="#current-instance_method" title="#current (instance method)">- (Object) <strong>current</strong> </a>
|
117
|
+
|
118
|
+
|
119
|
+
|
120
|
+
</span>
|
121
|
+
|
122
|
+
|
123
|
+
<span class="note title readonly">readonly</span>
|
124
|
+
|
125
|
+
|
126
|
+
|
127
|
+
|
128
|
+
|
129
|
+
|
130
|
+
|
131
|
+
|
132
|
+
<span class="summary_desc"><div class='inline'>
|
133
|
+
<p>Returns the value of attribute current.</p>
|
134
|
+
</div></span>
|
135
|
+
|
136
|
+
</li>
|
137
|
+
|
138
|
+
|
139
|
+
<li class="public ">
|
140
|
+
<span class="summary_signature">
|
141
|
+
|
142
|
+
<a href="#start_time-instance_method" title="#start_time (instance method)">- (Object) <strong>start_time</strong> </a>
|
143
|
+
|
144
|
+
|
145
|
+
|
146
|
+
</span>
|
147
|
+
|
148
|
+
|
149
|
+
|
150
|
+
|
151
|
+
|
152
|
+
|
153
|
+
|
154
|
+
|
155
|
+
|
156
|
+
|
157
|
+
|
158
|
+
<span class="summary_desc"><div class='inline'>
|
159
|
+
<p>Returns the value of attribute start_time.</p>
|
160
|
+
</div></span>
|
161
|
+
|
162
|
+
</li>
|
163
|
+
|
164
|
+
|
165
|
+
<li class="public ">
|
166
|
+
<span class="summary_signature">
|
167
|
+
|
168
|
+
<a href="#title-instance_method" title="#title (instance method)">- (Object) <strong>title</strong> </a>
|
169
|
+
|
170
|
+
|
171
|
+
|
172
|
+
</span>
|
173
|
+
|
174
|
+
|
175
|
+
<span class="note title readonly">readonly</span>
|
176
|
+
|
177
|
+
|
178
|
+
|
179
|
+
|
180
|
+
|
181
|
+
|
182
|
+
|
183
|
+
|
184
|
+
<span class="summary_desc"><div class='inline'>
|
185
|
+
<p>Returns the value of attribute title.</p>
|
186
|
+
</div></span>
|
187
|
+
|
188
|
+
</li>
|
189
|
+
|
190
|
+
|
191
|
+
<li class="public ">
|
192
|
+
<span class="summary_signature">
|
193
|
+
|
194
|
+
<a href="#title_width-instance_method" title="#title_width (instance method)">- (Object) <strong>title_width</strong> </a>
|
195
|
+
|
196
|
+
|
197
|
+
|
198
|
+
</span>
|
199
|
+
|
200
|
+
|
201
|
+
|
202
|
+
|
203
|
+
|
204
|
+
|
205
|
+
|
206
|
+
|
207
|
+
|
208
|
+
|
209
|
+
|
210
|
+
<span class="summary_desc"><div class='inline'>
|
211
|
+
<p>Returns the value of attribute title_width.</p>
|
212
|
+
</div></span>
|
213
|
+
|
214
|
+
</li>
|
215
|
+
|
216
|
+
|
217
|
+
<li class="public ">
|
218
|
+
<span class="summary_signature">
|
219
|
+
|
220
|
+
<a href="#total-instance_method" title="#total (instance method)">- (Object) <strong>total</strong> </a>
|
221
|
+
|
222
|
+
|
223
|
+
|
224
|
+
</span>
|
225
|
+
|
226
|
+
|
227
|
+
<span class="note title readonly">readonly</span>
|
228
|
+
|
229
|
+
|
230
|
+
|
231
|
+
|
232
|
+
|
233
|
+
|
234
|
+
|
235
|
+
|
236
|
+
<span class="summary_desc"><div class='inline'>
|
237
|
+
<p>Returns the value of attribute total.</p>
|
238
|
+
</div></span>
|
239
|
+
|
240
|
+
</li>
|
241
|
+
|
242
|
+
|
243
|
+
</ul>
|
244
|
+
|
245
|
+
|
246
|
+
|
247
|
+
<h2>
|
248
|
+
Instance Method Summary
|
249
|
+
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
|
250
|
+
</h2>
|
251
|
+
|
252
|
+
<ul class="summary">
|
253
|
+
|
254
|
+
<li class="public ">
|
255
|
+
<span class="summary_signature">
|
256
|
+
|
257
|
+
<a href="#bytes-instance_method" title="#bytes (instance method)">- (Object) <strong>bytes</strong> </a>
|
258
|
+
|
259
|
+
|
260
|
+
|
261
|
+
</span>
|
262
|
+
|
263
|
+
|
264
|
+
|
265
|
+
|
266
|
+
|
267
|
+
|
268
|
+
|
269
|
+
|
270
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
271
|
+
|
272
|
+
</li>
|
273
|
+
|
274
|
+
|
275
|
+
<li class="public ">
|
276
|
+
<span class="summary_signature">
|
277
|
+
|
278
|
+
<a href="#clear-instance_method" title="#clear (instance method)">- (Object) <strong>clear</strong> </a>
|
279
|
+
|
280
|
+
|
281
|
+
|
282
|
+
</span>
|
283
|
+
|
284
|
+
|
285
|
+
|
286
|
+
|
287
|
+
|
288
|
+
|
289
|
+
|
290
|
+
|
291
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
292
|
+
|
293
|
+
</li>
|
294
|
+
|
295
|
+
|
296
|
+
<li class="public ">
|
297
|
+
<span class="summary_signature">
|
298
|
+
|
299
|
+
<a href="#convert_bytes-instance_method" title="#convert_bytes (instance method)">- (Object) <strong>convert_bytes</strong>(bytes) </a>
|
300
|
+
|
301
|
+
|
302
|
+
|
303
|
+
</span>
|
304
|
+
|
305
|
+
|
306
|
+
|
307
|
+
|
308
|
+
|
309
|
+
|
310
|
+
|
311
|
+
|
312
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
313
|
+
|
314
|
+
</li>
|
315
|
+
|
316
|
+
|
317
|
+
<li class="public ">
|
318
|
+
<span class="summary_signature">
|
319
|
+
|
320
|
+
<a href="#do_percentage-instance_method" title="#do_percentage (instance method)">- (Object) <strong>do_percentage</strong> </a>
|
321
|
+
|
322
|
+
|
323
|
+
|
324
|
+
</span>
|
325
|
+
|
326
|
+
|
327
|
+
|
328
|
+
|
329
|
+
|
330
|
+
|
331
|
+
|
332
|
+
|
333
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
334
|
+
|
335
|
+
</li>
|
336
|
+
|
337
|
+
|
338
|
+
<li class="public ">
|
339
|
+
<span class="summary_signature">
|
340
|
+
|
341
|
+
<a href="#elapsed-instance_method" title="#elapsed (instance method)">- (Object) <strong>elapsed</strong> </a>
|
342
|
+
|
343
|
+
|
344
|
+
|
345
|
+
</span>
|
346
|
+
|
347
|
+
|
348
|
+
|
349
|
+
|
350
|
+
|
351
|
+
|
352
|
+
|
353
|
+
|
354
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
355
|
+
|
356
|
+
</li>
|
357
|
+
|
358
|
+
|
359
|
+
<li class="public ">
|
360
|
+
<span class="summary_signature">
|
361
|
+
|
362
|
+
<a href="#eol-instance_method" title="#eol (instance method)">- (Object) <strong>eol</strong> </a>
|
363
|
+
|
364
|
+
|
365
|
+
|
366
|
+
</span>
|
367
|
+
|
368
|
+
|
369
|
+
|
370
|
+
|
371
|
+
|
372
|
+
|
373
|
+
|
374
|
+
|
375
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
376
|
+
|
377
|
+
</li>
|
378
|
+
|
379
|
+
|
380
|
+
<li class="public ">
|
381
|
+
<span class="summary_signature">
|
382
|
+
|
383
|
+
<a href="#eta-instance_method" title="#eta (instance method)">- (Object) <strong>eta</strong> </a>
|
384
|
+
|
385
|
+
|
386
|
+
|
387
|
+
</span>
|
388
|
+
|
389
|
+
|
390
|
+
|
391
|
+
|
392
|
+
|
393
|
+
|
394
|
+
|
395
|
+
|
396
|
+
<span class="summary_desc"><div class='inline'>
|
397
|
+
<p>ETA stands for Estimated Time of Arrival.</p>
|
398
|
+
</div></span>
|
399
|
+
|
400
|
+
</li>
|
401
|
+
|
402
|
+
|
403
|
+
<li class="public ">
|
404
|
+
<span class="summary_signature">
|
405
|
+
|
406
|
+
<a href="#file_transfer_mode-instance_method" title="#file_transfer_mode (instance method)">- (Object) <strong>file_transfer_mode</strong> </a>
|
407
|
+
|
408
|
+
|
409
|
+
|
410
|
+
</span>
|
411
|
+
|
412
|
+
|
413
|
+
|
414
|
+
|
415
|
+
|
416
|
+
|
417
|
+
|
418
|
+
|
419
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
420
|
+
|
421
|
+
</li>
|
422
|
+
|
423
|
+
|
424
|
+
<li class="public ">
|
425
|
+
<span class="summary_signature">
|
426
|
+
|
427
|
+
<a href="#finish-instance_method" title="#finish (instance method)">- (Object) <strong>finish</strong> </a>
|
428
|
+
|
429
|
+
|
430
|
+
|
431
|
+
</span>
|
432
|
+
|
433
|
+
|
434
|
+
|
435
|
+
|
436
|
+
|
437
|
+
|
438
|
+
|
439
|
+
|
440
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
441
|
+
|
442
|
+
</li>
|
443
|
+
|
444
|
+
|
445
|
+
<li class="public ">
|
446
|
+
<span class="summary_signature">
|
447
|
+
|
448
|
+
<a href="#finished%3F-instance_method" title="#finished? (instance method)">- (Boolean) <strong>finished?</strong> </a>
|
449
|
+
|
450
|
+
|
451
|
+
|
452
|
+
</span>
|
453
|
+
|
454
|
+
|
455
|
+
|
456
|
+
|
457
|
+
|
458
|
+
|
459
|
+
|
460
|
+
|
461
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
462
|
+
|
463
|
+
</li>
|
464
|
+
|
465
|
+
|
466
|
+
<li class="public ">
|
467
|
+
<span class="summary_signature">
|
468
|
+
|
469
|
+
<a href="#fmt_bar-instance_method" title="#fmt_bar (instance method)">- (Object) <strong>fmt_bar</strong> </a>
|
470
|
+
|
471
|
+
|
472
|
+
|
473
|
+
</span>
|
474
|
+
|
475
|
+
|
476
|
+
|
477
|
+
|
478
|
+
|
479
|
+
|
480
|
+
|
481
|
+
|
482
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
483
|
+
|
484
|
+
</li>
|
485
|
+
|
486
|
+
|
487
|
+
<li class="public ">
|
488
|
+
<span class="summary_signature">
|
489
|
+
|
490
|
+
<a href="#fmt_percentage-instance_method" title="#fmt_percentage (instance method)">- (Object) <strong>fmt_percentage</strong> </a>
|
491
|
+
|
492
|
+
|
493
|
+
|
494
|
+
</span>
|
495
|
+
|
496
|
+
|
497
|
+
|
498
|
+
|
499
|
+
|
500
|
+
|
501
|
+
|
502
|
+
|
503
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
504
|
+
|
505
|
+
</li>
|
506
|
+
|
507
|
+
|
508
|
+
<li class="public ">
|
509
|
+
<span class="summary_signature">
|
510
|
+
|
511
|
+
<a href="#fmt_stat-instance_method" title="#fmt_stat (instance method)">- (Object) <strong>fmt_stat</strong> </a>
|
512
|
+
|
513
|
+
|
514
|
+
|
515
|
+
</span>
|
516
|
+
|
517
|
+
|
518
|
+
|
519
|
+
|
520
|
+
|
521
|
+
|
522
|
+
|
523
|
+
|
524
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
525
|
+
|
526
|
+
</li>
|
527
|
+
|
528
|
+
|
529
|
+
<li class="public ">
|
530
|
+
<span class="summary_signature">
|
531
|
+
|
532
|
+
<a href="#fmt_stat_for_file_transfer-instance_method" title="#fmt_stat_for_file_transfer (instance method)">- (Object) <strong>fmt_stat_for_file_transfer</strong> </a>
|
533
|
+
|
534
|
+
|
535
|
+
|
536
|
+
</span>
|
537
|
+
|
538
|
+
|
539
|
+
|
540
|
+
|
541
|
+
|
542
|
+
|
543
|
+
|
544
|
+
|
545
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
546
|
+
|
547
|
+
</li>
|
548
|
+
|
549
|
+
|
550
|
+
<li class="public ">
|
551
|
+
<span class="summary_signature">
|
552
|
+
|
553
|
+
<a href="#fmt_title-instance_method" title="#fmt_title (instance method)">- (Object) <strong>fmt_title</strong> </a>
|
554
|
+
|
555
|
+
|
556
|
+
|
557
|
+
</span>
|
558
|
+
|
559
|
+
|
560
|
+
|
561
|
+
|
562
|
+
|
563
|
+
|
564
|
+
|
565
|
+
|
566
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
567
|
+
|
568
|
+
</li>
|
569
|
+
|
570
|
+
|
571
|
+
<li class="public ">
|
572
|
+
<span class="summary_signature">
|
573
|
+
|
574
|
+
<a href="#format%3D-instance_method" title="#format= (instance method)">- (Object) <strong>format=</strong>(format) </a>
|
575
|
+
|
576
|
+
|
577
|
+
|
578
|
+
</span>
|
579
|
+
|
580
|
+
|
581
|
+
|
582
|
+
|
583
|
+
|
584
|
+
|
585
|
+
|
586
|
+
|
587
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
588
|
+
|
589
|
+
</li>
|
590
|
+
|
591
|
+
|
592
|
+
<li class="public ">
|
593
|
+
<span class="summary_signature">
|
594
|
+
|
595
|
+
<a href="#format_arguments%3D-instance_method" title="#format_arguments= (instance method)">- (Object) <strong>format_arguments=</strong>(arguments) </a>
|
596
|
+
|
597
|
+
|
598
|
+
|
599
|
+
</span>
|
600
|
+
|
601
|
+
|
602
|
+
|
603
|
+
|
604
|
+
|
605
|
+
|
606
|
+
|
607
|
+
|
608
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
609
|
+
|
610
|
+
</li>
|
611
|
+
|
612
|
+
|
613
|
+
<li class="public ">
|
614
|
+
<span class="summary_signature">
|
615
|
+
|
616
|
+
<a href="#format_time-instance_method" title="#format_time (instance method)">- (Object) <strong>format_time</strong>(t) </a>
|
617
|
+
|
618
|
+
|
619
|
+
|
620
|
+
</span>
|
621
|
+
|
622
|
+
|
623
|
+
|
624
|
+
|
625
|
+
|
626
|
+
|
627
|
+
|
628
|
+
|
629
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
630
|
+
|
631
|
+
</li>
|
632
|
+
|
633
|
+
|
634
|
+
<li class="public ">
|
635
|
+
<span class="summary_signature">
|
636
|
+
|
637
|
+
<a href="#get_width-instance_method" title="#get_width (instance method)">- (Object) <strong>get_width</strong> </a>
|
638
|
+
|
639
|
+
|
640
|
+
|
641
|
+
</span>
|
642
|
+
|
643
|
+
|
644
|
+
|
645
|
+
|
646
|
+
|
647
|
+
|
648
|
+
|
649
|
+
|
650
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
651
|
+
|
652
|
+
</li>
|
653
|
+
|
654
|
+
|
655
|
+
<li class="public ">
|
656
|
+
<span class="summary_signature">
|
657
|
+
|
658
|
+
<a href="#halt-instance_method" title="#halt (instance method)">- (Object) <strong>halt</strong> </a>
|
659
|
+
|
660
|
+
|
661
|
+
|
662
|
+
</span>
|
663
|
+
|
664
|
+
|
665
|
+
|
666
|
+
|
667
|
+
|
668
|
+
|
669
|
+
|
670
|
+
|
671
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
672
|
+
|
673
|
+
</li>
|
674
|
+
|
675
|
+
|
676
|
+
<li class="public ">
|
677
|
+
<span class="summary_signature">
|
678
|
+
|
679
|
+
<a href="#inc-instance_method" title="#inc (instance method)">- (Object) <strong>inc</strong>(step = 1) </a>
|
680
|
+
|
681
|
+
|
682
|
+
|
683
|
+
</span>
|
684
|
+
|
685
|
+
|
686
|
+
|
687
|
+
|
688
|
+
|
689
|
+
|
690
|
+
|
691
|
+
|
692
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
693
|
+
|
694
|
+
</li>
|
695
|
+
|
696
|
+
|
697
|
+
<li class="public ">
|
698
|
+
<span class="summary_signature">
|
699
|
+
|
700
|
+
<a href="#initialize-instance_method" title="#initialize (instance method)">- (ProgressBarImpl) <strong>initialize</strong>(title, total, out = STDERR) </a>
|
701
|
+
|
702
|
+
|
703
|
+
|
704
|
+
</span>
|
705
|
+
|
706
|
+
<span class="note title constructor">constructor</span>
|
707
|
+
|
708
|
+
|
709
|
+
|
710
|
+
|
711
|
+
|
712
|
+
|
713
|
+
|
714
|
+
|
715
|
+
<span class="summary_desc"><div class='inline'>
|
716
|
+
<p>A new instance of ProgressBarImpl.</p>
|
717
|
+
</div></span>
|
718
|
+
|
719
|
+
</li>
|
720
|
+
|
721
|
+
|
722
|
+
<li class="public ">
|
723
|
+
<span class="summary_signature">
|
724
|
+
|
725
|
+
<a href="#inspect-instance_method" title="#inspect (instance method)">- (Object) <strong>inspect</strong> </a>
|
726
|
+
|
727
|
+
|
728
|
+
|
729
|
+
</span>
|
730
|
+
|
731
|
+
|
732
|
+
|
733
|
+
|
734
|
+
|
735
|
+
|
736
|
+
|
737
|
+
|
738
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
739
|
+
|
740
|
+
</li>
|
741
|
+
|
742
|
+
|
743
|
+
<li class="public ">
|
744
|
+
<span class="summary_signature">
|
745
|
+
|
746
|
+
<a href="#set-instance_method" title="#set (instance method)">- (Object) <strong>set</strong>(count) </a>
|
747
|
+
|
748
|
+
|
749
|
+
|
750
|
+
</span>
|
751
|
+
|
752
|
+
|
753
|
+
|
754
|
+
|
755
|
+
|
756
|
+
|
757
|
+
|
758
|
+
|
759
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
760
|
+
|
761
|
+
</li>
|
762
|
+
|
763
|
+
|
764
|
+
<li class="public ">
|
765
|
+
<span class="summary_signature">
|
766
|
+
|
767
|
+
<a href="#show-instance_method" title="#show (instance method)">- (Object) <strong>show</strong> </a>
|
768
|
+
|
769
|
+
|
770
|
+
|
771
|
+
</span>
|
772
|
+
|
773
|
+
|
774
|
+
|
775
|
+
|
776
|
+
|
777
|
+
|
778
|
+
|
779
|
+
|
780
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
781
|
+
|
782
|
+
</li>
|
783
|
+
|
784
|
+
|
785
|
+
<li class="public ">
|
786
|
+
<span class="summary_signature">
|
787
|
+
|
788
|
+
<a href="#show_if_needed-instance_method" title="#show_if_needed (instance method)">- (Object) <strong>show_if_needed</strong> </a>
|
789
|
+
|
790
|
+
|
791
|
+
|
792
|
+
</span>
|
793
|
+
|
794
|
+
|
795
|
+
|
796
|
+
|
797
|
+
|
798
|
+
|
799
|
+
|
800
|
+
|
801
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
802
|
+
|
803
|
+
</li>
|
804
|
+
|
805
|
+
|
806
|
+
<li class="public ">
|
807
|
+
<span class="summary_signature">
|
808
|
+
|
809
|
+
<a href="#transfer_rate-instance_method" title="#transfer_rate (instance method)">- (Object) <strong>transfer_rate</strong> </a>
|
810
|
+
|
811
|
+
|
812
|
+
|
813
|
+
</span>
|
814
|
+
|
815
|
+
|
816
|
+
|
817
|
+
|
818
|
+
|
819
|
+
|
820
|
+
|
821
|
+
|
822
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
823
|
+
|
824
|
+
</li>
|
825
|
+
|
826
|
+
|
827
|
+
</ul>
|
828
|
+
|
829
|
+
|
830
|
+
<div id="constructor_details" class="method_details_list">
|
831
|
+
<h2>Constructor Details</h2>
|
832
|
+
|
833
|
+
<div class="method_details first">
|
834
|
+
<p class="signature first" id="initialize-instance_method">
|
835
|
+
|
836
|
+
- (<tt><span class='object_link'><a href="" title="Sprout::ProgressBarImpl (class)">ProgressBarImpl</a></span></tt>) <strong>initialize</strong>(title, total, out = STDERR)
|
837
|
+
|
838
|
+
|
839
|
+
|
840
|
+
</p><div class="docstring">
|
841
|
+
<div class="discussion">
|
842
|
+
|
843
|
+
<p>A new instance of ProgressBarImpl</p>
|
844
|
+
|
845
|
+
|
846
|
+
</div>
|
847
|
+
</div>
|
848
|
+
<div class="tags">
|
849
|
+
|
850
|
+
</div><table class="source_code">
|
851
|
+
<tr>
|
852
|
+
<td>
|
853
|
+
<pre class="lines">
|
854
|
+
|
855
|
+
|
856
|
+
46
|
857
|
+
47
|
858
|
+
48
|
859
|
+
49
|
860
|
+
50
|
861
|
+
51
|
862
|
+
52
|
863
|
+
53
|
864
|
+
54
|
865
|
+
55
|
866
|
+
56
|
867
|
+
57
|
868
|
+
58
|
869
|
+
59
|
870
|
+
60
|
871
|
+
61
|
872
|
+
62</pre>
|
873
|
+
</td>
|
874
|
+
<td>
|
875
|
+
<pre class="code"><span class="info file"># File 'lib/sprout/progress_bar.rb', line 46</span>
|
876
|
+
|
877
|
+
<span class='kw'>def</span> <span class='id initialize'>initialize</span> <span class='lparen'>(</span><span class='id title'>title</span><span class='comma'>,</span> <span class='id total'>total</span><span class='comma'>,</span> <span class='id out'>out</span> <span class='op'>=</span> <span class='const'>STDERR</span><span class='rparen'>)</span>
|
878
|
+
<span class='ivar'>@title</span> <span class='op'>=</span> <span class='id title'>title</span>
|
879
|
+
<span class='ivar'>@total</span> <span class='op'>=</span> <span class='id total'>total</span>
|
880
|
+
<span class='ivar'>@out</span> <span class='op'>=</span> <span class='id out'>out</span>
|
881
|
+
<span class='ivar'>@terminal_width</span> <span class='op'>=</span> <span class='int'>80</span>
|
882
|
+
<span class='ivar'>@bar_mark</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>.</span><span class='tstring_end'>"</span></span>
|
883
|
+
<span class='ivar'>@current</span> <span class='op'>=</span> <span class='int'>0</span>
|
884
|
+
<span class='ivar'>@previous</span> <span class='op'>=</span> <span class='int'>0</span>
|
885
|
+
<span class='ivar'>@finished_p</span> <span class='op'>=</span> <span class='kw'>false</span>
|
886
|
+
<span class='ivar'>@start_time</span> <span class='op'>=</span> <span class='const'>Time</span><span class='period'>.</span><span class='id now'>now</span>
|
887
|
+
<span class='ivar'>@previous_time</span> <span class='op'>=</span> <span class='ivar'>@start_time</span>
|
888
|
+
<span class='ivar'>@title_width</span> <span class='op'>=</span> <span class='int'>18</span>
|
889
|
+
<span class='ivar'>@format</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>%-</span><span class='embexpr_beg'>#{</span><span class='ivar'>@title_width</span><span class='rbrace'>}</span><span class='tstring_content'>s %3d%% %s %s</span><span class='tstring_end'>"</span></span>
|
890
|
+
<span class='ivar'>@format_arguments</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='symbol'>:title</span><span class='comma'>,</span> <span class='symbol'>:percentage</span><span class='comma'>,</span> <span class='symbol'>:bar</span><span class='comma'>,</span> <span class='symbol'>:stat</span><span class='rbracket'>]</span>
|
891
|
+
<span class='id clear'>clear</span>
|
892
|
+
<span class='id show'>show</span>
|
893
|
+
<span class='kw'>end</span></pre>
|
894
|
+
</td>
|
895
|
+
</tr>
|
896
|
+
</table>
|
897
|
+
</div>
|
898
|
+
|
899
|
+
</div>
|
900
|
+
|
901
|
+
<div id="instance_attr_details" class="attr_details">
|
902
|
+
<h2>Instance Attribute Details</h2>
|
903
|
+
|
904
|
+
|
905
|
+
<span id="bar_mark=-instance_method"></span>
|
906
|
+
<span id="bar_mark-instance_method"></span>
|
907
|
+
<div class="method_details first">
|
908
|
+
<p class="signature first" id="bar_mark-instance_method">
|
909
|
+
|
910
|
+
- (<tt>Object</tt>) <strong>bar_mark</strong>
|
911
|
+
|
912
|
+
|
913
|
+
|
914
|
+
</p><div class="docstring">
|
915
|
+
<div class="discussion">
|
916
|
+
|
917
|
+
<p>Returns the value of attribute bar_mark</p>
|
918
|
+
|
919
|
+
|
920
|
+
</div>
|
921
|
+
</div>
|
922
|
+
<div class="tags">
|
923
|
+
|
924
|
+
</div><table class="source_code">
|
925
|
+
<tr>
|
926
|
+
<td>
|
927
|
+
<pre class="lines">
|
928
|
+
|
929
|
+
|
930
|
+
66
|
931
|
+
67
|
932
|
+
68</pre>
|
933
|
+
</td>
|
934
|
+
<td>
|
935
|
+
<pre class="code"><span class="info file"># File 'lib/sprout/progress_bar.rb', line 66</span>
|
936
|
+
|
937
|
+
<span class='kw'>def</span> <span class='id bar_mark'>bar_mark</span>
|
938
|
+
<span class='ivar'>@bar_mark</span>
|
939
|
+
<span class='kw'>end</span></pre>
|
940
|
+
</td>
|
941
|
+
</tr>
|
942
|
+
</table>
|
943
|
+
</div>
|
944
|
+
|
945
|
+
|
946
|
+
<span id=""></span>
|
947
|
+
<span id="current-instance_method"></span>
|
948
|
+
<div class="method_details ">
|
949
|
+
<p class="signature " id="current-instance_method">
|
950
|
+
|
951
|
+
- (<tt>Object</tt>) <strong>current</strong> <span class="extras">(readonly)</span>
|
952
|
+
|
953
|
+
|
954
|
+
|
955
|
+
</p><div class="docstring">
|
956
|
+
<div class="discussion">
|
957
|
+
|
958
|
+
<p>Returns the value of attribute current</p>
|
959
|
+
|
960
|
+
|
961
|
+
</div>
|
962
|
+
</div>
|
963
|
+
<div class="tags">
|
964
|
+
|
965
|
+
</div><table class="source_code">
|
966
|
+
<tr>
|
967
|
+
<td>
|
968
|
+
<pre class="lines">
|
969
|
+
|
970
|
+
|
971
|
+
64
|
972
|
+
65
|
973
|
+
66</pre>
|
974
|
+
</td>
|
975
|
+
<td>
|
976
|
+
<pre class="code"><span class="info file"># File 'lib/sprout/progress_bar.rb', line 64</span>
|
977
|
+
|
978
|
+
<span class='kw'>def</span> <span class='id current'>current</span>
|
979
|
+
<span class='ivar'>@current</span>
|
980
|
+
<span class='kw'>end</span></pre>
|
981
|
+
</td>
|
982
|
+
</tr>
|
983
|
+
</table>
|
984
|
+
</div>
|
985
|
+
|
986
|
+
|
987
|
+
<span id="start_time=-instance_method"></span>
|
988
|
+
<span id="start_time-instance_method"></span>
|
989
|
+
<div class="method_details ">
|
990
|
+
<p class="signature " id="start_time-instance_method">
|
991
|
+
|
992
|
+
- (<tt>Object</tt>) <strong>start_time</strong>
|
993
|
+
|
994
|
+
|
995
|
+
|
996
|
+
</p><div class="docstring">
|
997
|
+
<div class="discussion">
|
998
|
+
|
999
|
+
<p>Returns the value of attribute start_time</p>
|
1000
|
+
|
1001
|
+
|
1002
|
+
</div>
|
1003
|
+
</div>
|
1004
|
+
<div class="tags">
|
1005
|
+
|
1006
|
+
</div><table class="source_code">
|
1007
|
+
<tr>
|
1008
|
+
<td>
|
1009
|
+
<pre class="lines">
|
1010
|
+
|
1011
|
+
|
1012
|
+
66
|
1013
|
+
67
|
1014
|
+
68</pre>
|
1015
|
+
</td>
|
1016
|
+
<td>
|
1017
|
+
<pre class="code"><span class="info file"># File 'lib/sprout/progress_bar.rb', line 66</span>
|
1018
|
+
|
1019
|
+
<span class='kw'>def</span> <span class='id start_time'>start_time</span>
|
1020
|
+
<span class='ivar'>@start_time</span>
|
1021
|
+
<span class='kw'>end</span></pre>
|
1022
|
+
</td>
|
1023
|
+
</tr>
|
1024
|
+
</table>
|
1025
|
+
</div>
|
1026
|
+
|
1027
|
+
|
1028
|
+
<span id=""></span>
|
1029
|
+
<span id="title-instance_method"></span>
|
1030
|
+
<div class="method_details ">
|
1031
|
+
<p class="signature " id="title-instance_method">
|
1032
|
+
|
1033
|
+
- (<tt>Object</tt>) <strong>title</strong> <span class="extras">(readonly)</span>
|
1034
|
+
|
1035
|
+
|
1036
|
+
|
1037
|
+
</p><div class="docstring">
|
1038
|
+
<div class="discussion">
|
1039
|
+
|
1040
|
+
<p>Returns the value of attribute title</p>
|
1041
|
+
|
1042
|
+
|
1043
|
+
</div>
|
1044
|
+
</div>
|
1045
|
+
<div class="tags">
|
1046
|
+
|
1047
|
+
</div><table class="source_code">
|
1048
|
+
<tr>
|
1049
|
+
<td>
|
1050
|
+
<pre class="lines">
|
1051
|
+
|
1052
|
+
|
1053
|
+
63
|
1054
|
+
64
|
1055
|
+
65</pre>
|
1056
|
+
</td>
|
1057
|
+
<td>
|
1058
|
+
<pre class="code"><span class="info file"># File 'lib/sprout/progress_bar.rb', line 63</span>
|
1059
|
+
|
1060
|
+
<span class='kw'>def</span> <span class='id title'>title</span>
|
1061
|
+
<span class='ivar'>@title</span>
|
1062
|
+
<span class='kw'>end</span></pre>
|
1063
|
+
</td>
|
1064
|
+
</tr>
|
1065
|
+
</table>
|
1066
|
+
</div>
|
1067
|
+
|
1068
|
+
|
1069
|
+
<span id="title_width=-instance_method"></span>
|
1070
|
+
<span id="title_width-instance_method"></span>
|
1071
|
+
<div class="method_details ">
|
1072
|
+
<p class="signature " id="title_width-instance_method">
|
1073
|
+
|
1074
|
+
- (<tt>Object</tt>) <strong>title_width</strong>
|
1075
|
+
|
1076
|
+
|
1077
|
+
|
1078
|
+
</p><div class="docstring">
|
1079
|
+
<div class="discussion">
|
1080
|
+
|
1081
|
+
<p>Returns the value of attribute title_width</p>
|
1082
|
+
|
1083
|
+
|
1084
|
+
</div>
|
1085
|
+
</div>
|
1086
|
+
<div class="tags">
|
1087
|
+
|
1088
|
+
</div><table class="source_code">
|
1089
|
+
<tr>
|
1090
|
+
<td>
|
1091
|
+
<pre class="lines">
|
1092
|
+
|
1093
|
+
|
1094
|
+
66
|
1095
|
+
67
|
1096
|
+
68</pre>
|
1097
|
+
</td>
|
1098
|
+
<td>
|
1099
|
+
<pre class="code"><span class="info file"># File 'lib/sprout/progress_bar.rb', line 66</span>
|
1100
|
+
|
1101
|
+
<span class='kw'>def</span> <span class='id title_width'>title_width</span>
|
1102
|
+
<span class='ivar'>@title_width</span>
|
1103
|
+
<span class='kw'>end</span></pre>
|
1104
|
+
</td>
|
1105
|
+
</tr>
|
1106
|
+
</table>
|
1107
|
+
</div>
|
1108
|
+
|
1109
|
+
|
1110
|
+
<span id=""></span>
|
1111
|
+
<span id="total-instance_method"></span>
|
1112
|
+
<div class="method_details ">
|
1113
|
+
<p class="signature " id="total-instance_method">
|
1114
|
+
|
1115
|
+
- (<tt>Object</tt>) <strong>total</strong> <span class="extras">(readonly)</span>
|
1116
|
+
|
1117
|
+
|
1118
|
+
|
1119
|
+
</p><div class="docstring">
|
1120
|
+
<div class="discussion">
|
1121
|
+
|
1122
|
+
<p>Returns the value of attribute total</p>
|
1123
|
+
|
1124
|
+
|
1125
|
+
</div>
|
1126
|
+
</div>
|
1127
|
+
<div class="tags">
|
1128
|
+
|
1129
|
+
</div><table class="source_code">
|
1130
|
+
<tr>
|
1131
|
+
<td>
|
1132
|
+
<pre class="lines">
|
1133
|
+
|
1134
|
+
|
1135
|
+
65
|
1136
|
+
66
|
1137
|
+
67</pre>
|
1138
|
+
</td>
|
1139
|
+
<td>
|
1140
|
+
<pre class="code"><span class="info file"># File 'lib/sprout/progress_bar.rb', line 65</span>
|
1141
|
+
|
1142
|
+
<span class='kw'>def</span> <span class='id total'>total</span>
|
1143
|
+
<span class='ivar'>@total</span>
|
1144
|
+
<span class='kw'>end</span></pre>
|
1145
|
+
</td>
|
1146
|
+
</tr>
|
1147
|
+
</table>
|
1148
|
+
</div>
|
1149
|
+
|
1150
|
+
</div>
|
1151
|
+
|
1152
|
+
|
1153
|
+
<div id="instance_method_details" class="method_details_list">
|
1154
|
+
<h2>Instance Method Details</h2>
|
1155
|
+
|
1156
|
+
|
1157
|
+
<div class="method_details first">
|
1158
|
+
<p class="signature first" id="bytes-instance_method">
|
1159
|
+
|
1160
|
+
- (<tt>Object</tt>) <strong>bytes</strong>
|
1161
|
+
|
1162
|
+
|
1163
|
+
|
1164
|
+
</p><table class="source_code">
|
1165
|
+
<tr>
|
1166
|
+
<td>
|
1167
|
+
<pre class="lines">
|
1168
|
+
|
1169
|
+
|
1170
|
+
114
|
1171
|
+
115
|
1172
|
+
116</pre>
|
1173
|
+
</td>
|
1174
|
+
<td>
|
1175
|
+
<pre class="code"><span class="info file"># File 'lib/sprout/progress_bar.rb', line 114</span>
|
1176
|
+
|
1177
|
+
<span class='kw'>def</span> <span class='id bytes'>bytes</span>
|
1178
|
+
<span class='id convert_bytes'>convert_bytes</span><span class='lparen'>(</span><span class='ivar'>@current</span><span class='rparen'>)</span>
|
1179
|
+
<span class='kw'>end</span></pre>
|
1180
|
+
</td>
|
1181
|
+
</tr>
|
1182
|
+
</table>
|
1183
|
+
</div>
|
1184
|
+
|
1185
|
+
<div class="method_details ">
|
1186
|
+
<p class="signature " id="clear-instance_method">
|
1187
|
+
|
1188
|
+
- (<tt>Object</tt>) <strong>clear</strong>
|
1189
|
+
|
1190
|
+
|
1191
|
+
|
1192
|
+
</p><table class="source_code">
|
1193
|
+
<tr>
|
1194
|
+
<td>
|
1195
|
+
<pre class="lines">
|
1196
|
+
|
1197
|
+
|
1198
|
+
214
|
1199
|
+
215
|
1200
|
+
216
|
1201
|
+
217
|
1202
|
+
218</pre>
|
1203
|
+
</td>
|
1204
|
+
<td>
|
1205
|
+
<pre class="code"><span class="info file"># File 'lib/sprout/progress_bar.rb', line 214</span>
|
1206
|
+
|
1207
|
+
<span class='kw'>def</span> <span class='id clear'>clear</span>
|
1208
|
+
<span class='ivar'>@out</span><span class='period'>.</span><span class='id print'>print</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>\r</span><span class='tstring_end'>"</span></span>
|
1209
|
+
<span class='ivar'>@out</span><span class='period'>.</span><span class='id print'>print</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='op'>*</span> <span class='lparen'>(</span><span class='id get_width'>get_width</span> <span class='op'>-</span> <span class='int'>1</span><span class='rparen'>)</span><span class='rparen'>)</span>
|
1210
|
+
<span class='ivar'>@out</span><span class='period'>.</span><span class='id print'>print</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>\r</span><span class='tstring_end'>"</span></span>
|
1211
|
+
<span class='kw'>end</span></pre>
|
1212
|
+
</td>
|
1213
|
+
</tr>
|
1214
|
+
</table>
|
1215
|
+
</div>
|
1216
|
+
|
1217
|
+
<div class="method_details ">
|
1218
|
+
<p class="signature " id="convert_bytes-instance_method">
|
1219
|
+
|
1220
|
+
- (<tt>Object</tt>) <strong>convert_bytes</strong>(bytes)
|
1221
|
+
|
1222
|
+
|
1223
|
+
|
1224
|
+
</p><table class="source_code">
|
1225
|
+
<tr>
|
1226
|
+
<td>
|
1227
|
+
<pre class="lines">
|
1228
|
+
|
1229
|
+
|
1230
|
+
97
|
1231
|
+
98
|
1232
|
+
99
|
1233
|
+
100
|
1234
|
+
101
|
1235
|
+
102
|
1236
|
+
103
|
1237
|
+
104
|
1238
|
+
105
|
1239
|
+
106
|
1240
|
+
107</pre>
|
1241
|
+
</td>
|
1242
|
+
<td>
|
1243
|
+
<pre class="code"><span class="info file"># File 'lib/sprout/progress_bar.rb', line 97</span>
|
1244
|
+
|
1245
|
+
<span class='kw'>def</span> <span class='id convert_bytes'>convert_bytes</span> <span class='lparen'>(</span><span class='id bytes'>bytes</span><span class='rparen'>)</span>
|
1246
|
+
<span class='kw'>if</span> <span class='id bytes'>bytes</span> <span class='op'><</span> <span class='int'>1024</span>
|
1247
|
+
<span class='id sprintf'>sprintf</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>%6dB</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='id bytes'>bytes</span><span class='rparen'>)</span>
|
1248
|
+
<span class='kw'>elsif</span> <span class='id bytes'>bytes</span> <span class='op'><</span> <span class='int'>1024</span> <span class='op'>*</span> <span class='int'>1000</span> <span class='comment'># 1000kb
|
1249
|
+
</span> <span class='id sprintf'>sprintf</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>%5.1fKB</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='id bytes'>bytes</span><span class='period'>.</span><span class='id to_f'>to_f</span> <span class='op'>/</span> <span class='int'>1024</span><span class='rparen'>)</span>
|
1250
|
+
<span class='kw'>elsif</span> <span class='id bytes'>bytes</span> <span class='op'><</span> <span class='int'>1024</span> <span class='op'>*</span> <span class='int'>1024</span> <span class='op'>*</span> <span class='int'>1000</span> <span class='comment'># 1000mb
|
1251
|
+
</span> <span class='id sprintf'>sprintf</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>%5.1fMB</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='id bytes'>bytes</span><span class='period'>.</span><span class='id to_f'>to_f</span> <span class='op'>/</span> <span class='int'>1024</span> <span class='op'>/</span> <span class='int'>1024</span><span class='rparen'>)</span>
|
1252
|
+
<span class='kw'>else</span>
|
1253
|
+
<span class='id sprintf'>sprintf</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>%5.1fGB</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='id bytes'>bytes</span><span class='period'>.</span><span class='id to_f'>to_f</span> <span class='op'>/</span> <span class='int'>1024</span> <span class='op'>/</span> <span class='int'>1024</span> <span class='op'>/</span> <span class='int'>1024</span><span class='rparen'>)</span>
|
1254
|
+
<span class='kw'>end</span>
|
1255
|
+
<span class='kw'>end</span></pre>
|
1256
|
+
</td>
|
1257
|
+
</tr>
|
1258
|
+
</table>
|
1259
|
+
</div>
|
1260
|
+
|
1261
|
+
<div class="method_details ">
|
1262
|
+
<p class="signature " id="do_percentage-instance_method">
|
1263
|
+
|
1264
|
+
- (<tt>Object</tt>) <strong>do_percentage</strong>
|
1265
|
+
|
1266
|
+
|
1267
|
+
|
1268
|
+
</p><table class="source_code">
|
1269
|
+
<tr>
|
1270
|
+
<td>
|
1271
|
+
<pre class="lines">
|
1272
|
+
|
1273
|
+
|
1274
|
+
146
|
1275
|
+
147
|
1276
|
+
148
|
1277
|
+
149
|
1278
|
+
150
|
1279
|
+
151
|
1280
|
+
152</pre>
|
1281
|
+
</td>
|
1282
|
+
<td>
|
1283
|
+
<pre class="code"><span class="info file"># File 'lib/sprout/progress_bar.rb', line 146</span>
|
1284
|
+
|
1285
|
+
<span class='kw'>def</span> <span class='id do_percentage'>do_percentage</span>
|
1286
|
+
<span class='kw'>if</span> <span class='ivar'>@total</span><span class='period'>.</span><span class='id zero?'>zero?</span>
|
1287
|
+
<span class='int'>100</span>
|
1288
|
+
<span class='kw'>else</span>
|
1289
|
+
<span class='ivar'>@current</span> <span class='op'>*</span> <span class='int'>100</span> <span class='op'>/</span> <span class='ivar'>@total</span>
|
1290
|
+
<span class='kw'>end</span>
|
1291
|
+
<span class='kw'>end</span></pre>
|
1292
|
+
</td>
|
1293
|
+
</tr>
|
1294
|
+
</table>
|
1295
|
+
</div>
|
1296
|
+
|
1297
|
+
<div class="method_details ">
|
1298
|
+
<p class="signature " id="elapsed-instance_method">
|
1299
|
+
|
1300
|
+
- (<tt>Object</tt>) <strong>elapsed</strong>
|
1301
|
+
|
1302
|
+
|
1303
|
+
|
1304
|
+
</p><table class="source_code">
|
1305
|
+
<tr>
|
1306
|
+
<td>
|
1307
|
+
<pre class="lines">
|
1308
|
+
|
1309
|
+
|
1310
|
+
137
|
1311
|
+
138
|
1312
|
+
139
|
1313
|
+
140</pre>
|
1314
|
+
</td>
|
1315
|
+
<td>
|
1316
|
+
<pre class="code"><span class="info file"># File 'lib/sprout/progress_bar.rb', line 137</span>
|
1317
|
+
|
1318
|
+
<span class='kw'>def</span> <span class='id elapsed'>elapsed</span>
|
1319
|
+
<span class='id elapsed_time'>elapsed_time</span> <span class='op'>=</span> <span class='const'>Time</span><span class='period'>.</span><span class='id now'>now</span> <span class='op'>-</span> <span class='ivar'>@start_time</span>
|
1320
|
+
<span class='id sprintf'>sprintf</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Time: %s</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='id format_time'>format_time</span><span class='lparen'>(</span><span class='id elapsed_time'>elapsed_time</span><span class='rparen'>)</span><span class='rparen'>)</span>
|
1321
|
+
<span class='kw'>end</span></pre>
|
1322
|
+
</td>
|
1323
|
+
</tr>
|
1324
|
+
</table>
|
1325
|
+
</div>
|
1326
|
+
|
1327
|
+
<div class="method_details ">
|
1328
|
+
<p class="signature " id="eol-instance_method">
|
1329
|
+
|
1330
|
+
- (<tt>Object</tt>) <strong>eol</strong>
|
1331
|
+
|
1332
|
+
|
1333
|
+
|
1334
|
+
</p><table class="source_code">
|
1335
|
+
<tr>
|
1336
|
+
<td>
|
1337
|
+
<pre class="lines">
|
1338
|
+
|
1339
|
+
|
1340
|
+
142
|
1341
|
+
143
|
1342
|
+
144</pre>
|
1343
|
+
</td>
|
1344
|
+
<td>
|
1345
|
+
<pre class="code"><span class="info file"># File 'lib/sprout/progress_bar.rb', line 142</span>
|
1346
|
+
|
1347
|
+
<span class='kw'>def</span> <span class='id eol'>eol</span>
|
1348
|
+
<span class='kw'>if</span> <span class='ivar'>@finished_p</span> <span class='kw'>then</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>\n</span><span class='tstring_end'>"</span></span> <span class='kw'>else</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>\r</span><span class='tstring_end'>"</span></span> <span class='kw'>end</span>
|
1349
|
+
<span class='kw'>end</span></pre>
|
1350
|
+
</td>
|
1351
|
+
</tr>
|
1352
|
+
</table>
|
1353
|
+
</div>
|
1354
|
+
|
1355
|
+
<div class="method_details ">
|
1356
|
+
<p class="signature " id="eta-instance_method">
|
1357
|
+
|
1358
|
+
- (<tt>Object</tt>) <strong>eta</strong>
|
1359
|
+
|
1360
|
+
|
1361
|
+
|
1362
|
+
</p><div class="docstring">
|
1363
|
+
<div class="discussion">
|
1364
|
+
|
1365
|
+
<p>ETA stands for Estimated Time of Arrival.</p>
|
1366
|
+
|
1367
|
+
|
1368
|
+
</div>
|
1369
|
+
</div>
|
1370
|
+
<div class="tags">
|
1371
|
+
|
1372
|
+
</div><table class="source_code">
|
1373
|
+
<tr>
|
1374
|
+
<td>
|
1375
|
+
<pre class="lines">
|
1376
|
+
|
1377
|
+
|
1378
|
+
127
|
1379
|
+
128
|
1380
|
+
129
|
1381
|
+
130
|
1382
|
+
131
|
1383
|
+
132
|
1384
|
+
133
|
1385
|
+
134
|
1386
|
+
135</pre>
|
1387
|
+
</td>
|
1388
|
+
<td>
|
1389
|
+
<pre class="code"><span class="info file"># File 'lib/sprout/progress_bar.rb', line 127</span>
|
1390
|
+
|
1391
|
+
<span class='kw'>def</span> <span class='id eta'>eta</span>
|
1392
|
+
<span class='kw'>if</span> <span class='ivar'>@current</span> <span class='op'>==</span> <span class='int'>0</span>
|
1393
|
+
<span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>ETA: --:--:--</span><span class='tstring_end'>"</span></span>
|
1394
|
+
<span class='kw'>else</span>
|
1395
|
+
<span class='id elapsed_time'>elapsed_time</span> <span class='op'>=</span> <span class='const'>Time</span><span class='period'>.</span><span class='id now'>now</span> <span class='op'>-</span> <span class='ivar'>@start_time</span>
|
1396
|
+
<span class='id estimated_time'>estimated_time</span> <span class='op'>=</span> <span class='id elapsed_time'>elapsed_time</span> <span class='op'>*</span> <span class='ivar'>@total</span> <span class='op'>/</span> <span class='ivar'>@current</span> <span class='op'>-</span> <span class='id elapsed_time'>elapsed_time</span>
|
1397
|
+
<span class='id sprintf'>sprintf</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>ETA: %s</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='id format_time'>format_time</span><span class='lparen'>(</span><span class='id estimated_time'>estimated_time</span><span class='rparen'>)</span><span class='rparen'>)</span>
|
1398
|
+
<span class='kw'>end</span>
|
1399
|
+
<span class='kw'>end</span></pre>
|
1400
|
+
</td>
|
1401
|
+
</tr>
|
1402
|
+
</table>
|
1403
|
+
</div>
|
1404
|
+
|
1405
|
+
<div class="method_details ">
|
1406
|
+
<p class="signature " id="file_transfer_mode-instance_method">
|
1407
|
+
|
1408
|
+
- (<tt>Object</tt>) <strong>file_transfer_mode</strong>
|
1409
|
+
|
1410
|
+
|
1411
|
+
|
1412
|
+
</p><table class="source_code">
|
1413
|
+
<tr>
|
1414
|
+
<td>
|
1415
|
+
<pre class="lines">
|
1416
|
+
|
1417
|
+
|
1418
|
+
230
|
1419
|
+
231
|
1420
|
+
232</pre>
|
1421
|
+
</td>
|
1422
|
+
<td>
|
1423
|
+
<pre class="code"><span class="info file"># File 'lib/sprout/progress_bar.rb', line 230</span>
|
1424
|
+
|
1425
|
+
<span class='kw'>def</span> <span class='id file_transfer_mode'>file_transfer_mode</span>
|
1426
|
+
<span class='ivar'>@format_arguments</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='symbol'>:title</span><span class='comma'>,</span> <span class='symbol'>:percentage</span><span class='comma'>,</span> <span class='symbol'>:bar</span><span class='comma'>,</span> <span class='symbol'>:stat_for_file_transfer</span><span class='rbracket'>]</span>
|
1427
|
+
<span class='kw'>end</span></pre>
|
1428
|
+
</td>
|
1429
|
+
</tr>
|
1430
|
+
</table>
|
1431
|
+
</div>
|
1432
|
+
|
1433
|
+
<div class="method_details ">
|
1434
|
+
<p class="signature " id="finish-instance_method">
|
1435
|
+
|
1436
|
+
- (<tt>Object</tt>) <strong>finish</strong>
|
1437
|
+
|
1438
|
+
|
1439
|
+
|
1440
|
+
</p><table class="source_code">
|
1441
|
+
<tr>
|
1442
|
+
<td>
|
1443
|
+
<pre class="lines">
|
1444
|
+
|
1445
|
+
|
1446
|
+
220
|
1447
|
+
221
|
1448
|
+
222
|
1449
|
+
223
|
1450
|
+
224</pre>
|
1451
|
+
</td>
|
1452
|
+
<td>
|
1453
|
+
<pre class="code"><span class="info file"># File 'lib/sprout/progress_bar.rb', line 220</span>
|
1454
|
+
|
1455
|
+
<span class='kw'>def</span> <span class='id finish'>finish</span>
|
1456
|
+
<span class='ivar'>@current</span> <span class='op'>=</span> <span class='ivar'>@total</span>
|
1457
|
+
<span class='ivar'>@finished_p</span> <span class='op'>=</span> <span class='kw'>true</span>
|
1458
|
+
<span class='id show'>show</span>
|
1459
|
+
<span class='kw'>end</span></pre>
|
1460
|
+
</td>
|
1461
|
+
</tr>
|
1462
|
+
</table>
|
1463
|
+
</div>
|
1464
|
+
|
1465
|
+
<div class="method_details ">
|
1466
|
+
<p class="signature " id="finished?-instance_method">
|
1467
|
+
|
1468
|
+
- (<tt>Boolean</tt>) <strong>finished?</strong>
|
1469
|
+
|
1470
|
+
|
1471
|
+
|
1472
|
+
</p><div class="docstring">
|
1473
|
+
<div class="discussion">
|
1474
|
+
|
1475
|
+
|
1476
|
+
</div>
|
1477
|
+
</div>
|
1478
|
+
<div class="tags">
|
1479
|
+
<h3>Returns:</h3>
|
1480
|
+
<ul class="return">
|
1481
|
+
|
1482
|
+
<li>
|
1483
|
+
|
1484
|
+
<span class='type'>(<tt>Boolean</tt>)</span>
|
1485
|
+
|
1486
|
+
|
1487
|
+
|
1488
|
+
|
1489
|
+
</li>
|
1490
|
+
|
1491
|
+
</ul>
|
1492
|
+
|
1493
|
+
</div><table class="source_code">
|
1494
|
+
<tr>
|
1495
|
+
<td>
|
1496
|
+
<pre class="lines">
|
1497
|
+
|
1498
|
+
|
1499
|
+
226
|
1500
|
+
227
|
1501
|
+
228</pre>
|
1502
|
+
</td>
|
1503
|
+
<td>
|
1504
|
+
<pre class="code"><span class="info file"># File 'lib/sprout/progress_bar.rb', line 226</span>
|
1505
|
+
|
1506
|
+
<span class='kw'>def</span> <span class='id finished?'>finished?</span>
|
1507
|
+
<span class='ivar'>@finished_p</span>
|
1508
|
+
<span class='kw'>end</span></pre>
|
1509
|
+
</td>
|
1510
|
+
</tr>
|
1511
|
+
</table>
|
1512
|
+
</div>
|
1513
|
+
|
1514
|
+
<div class="method_details ">
|
1515
|
+
<p class="signature " id="fmt_bar-instance_method">
|
1516
|
+
|
1517
|
+
- (<tt>Object</tt>) <strong>fmt_bar</strong>
|
1518
|
+
|
1519
|
+
|
1520
|
+
|
1521
|
+
</p><table class="source_code">
|
1522
|
+
<tr>
|
1523
|
+
<td>
|
1524
|
+
<pre class="lines">
|
1525
|
+
|
1526
|
+
|
1527
|
+
70
|
1528
|
+
71
|
1529
|
+
72
|
1530
|
+
73
|
1531
|
+
74
|
1532
|
+
75</pre>
|
1533
|
+
</td>
|
1534
|
+
<td>
|
1535
|
+
<pre class="code"><span class="info file"># File 'lib/sprout/progress_bar.rb', line 70</span>
|
1536
|
+
|
1537
|
+
<span class='kw'>def</span> <span class='id fmt_bar'>fmt_bar</span>
|
1538
|
+
<span class='id bar_width'>bar_width</span> <span class='op'>=</span> <span class='id do_percentage'>do_percentage</span> <span class='op'>*</span> <span class='ivar'>@terminal_width</span> <span class='op'>/</span> <span class='int'>100</span>
|
1539
|
+
<span class='id sprintf'>sprintf</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>|%s%s|</span><span class='tstring_end'>"</span></span><span class='comma'>,</span>
|
1540
|
+
<span class='ivar'>@bar_mark</span> <span class='op'>*</span> <span class='id bar_width'>bar_width</span><span class='comma'>,</span>
|
1541
|
+
<span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'> </span><span class='tstring_end'>"</span></span> <span class='op'>*</span> <span class='lparen'>(</span><span class='ivar'>@terminal_width</span> <span class='op'>-</span> <span class='id bar_width'>bar_width</span><span class='rparen'>)</span><span class='rparen'>)</span>
|
1542
|
+
<span class='kw'>end</span></pre>
|
1543
|
+
</td>
|
1544
|
+
</tr>
|
1545
|
+
</table>
|
1546
|
+
</div>
|
1547
|
+
|
1548
|
+
<div class="method_details ">
|
1549
|
+
<p class="signature " id="fmt_percentage-instance_method">
|
1550
|
+
|
1551
|
+
- (<tt>Object</tt>) <strong>fmt_percentage</strong>
|
1552
|
+
|
1553
|
+
|
1554
|
+
|
1555
|
+
</p><table class="source_code">
|
1556
|
+
<tr>
|
1557
|
+
<td>
|
1558
|
+
<pre class="lines">
|
1559
|
+
|
1560
|
+
|
1561
|
+
77
|
1562
|
+
78
|
1563
|
+
79</pre>
|
1564
|
+
</td>
|
1565
|
+
<td>
|
1566
|
+
<pre class="code"><span class="info file"># File 'lib/sprout/progress_bar.rb', line 77</span>
|
1567
|
+
|
1568
|
+
<span class='kw'>def</span> <span class='id fmt_percentage'>fmt_percentage</span>
|
1569
|
+
<span class='id do_percentage'>do_percentage</span>
|
1570
|
+
<span class='kw'>end</span></pre>
|
1571
|
+
</td>
|
1572
|
+
</tr>
|
1573
|
+
</table>
|
1574
|
+
</div>
|
1575
|
+
|
1576
|
+
<div class="method_details ">
|
1577
|
+
<p class="signature " id="fmt_stat-instance_method">
|
1578
|
+
|
1579
|
+
- (<tt>Object</tt>) <strong>fmt_stat</strong>
|
1580
|
+
|
1581
|
+
|
1582
|
+
|
1583
|
+
</p><table class="source_code">
|
1584
|
+
<tr>
|
1585
|
+
<td>
|
1586
|
+
<pre class="lines">
|
1587
|
+
|
1588
|
+
|
1589
|
+
81
|
1590
|
+
82
|
1591
|
+
83</pre>
|
1592
|
+
</td>
|
1593
|
+
<td>
|
1594
|
+
<pre class="code"><span class="info file"># File 'lib/sprout/progress_bar.rb', line 81</span>
|
1595
|
+
|
1596
|
+
<span class='kw'>def</span> <span class='id fmt_stat'>fmt_stat</span>
|
1597
|
+
<span class='kw'>if</span> <span class='ivar'>@finished_p</span> <span class='kw'>then</span> <span class='id elapsed'>elapsed</span> <span class='kw'>else</span> <span class='id eta'>eta</span> <span class='kw'>end</span>
|
1598
|
+
<span class='kw'>end</span></pre>
|
1599
|
+
</td>
|
1600
|
+
</tr>
|
1601
|
+
</table>
|
1602
|
+
</div>
|
1603
|
+
|
1604
|
+
<div class="method_details ">
|
1605
|
+
<p class="signature " id="fmt_stat_for_file_transfer-instance_method">
|
1606
|
+
|
1607
|
+
- (<tt>Object</tt>) <strong>fmt_stat_for_file_transfer</strong>
|
1608
|
+
|
1609
|
+
|
1610
|
+
|
1611
|
+
</p><table class="source_code">
|
1612
|
+
<tr>
|
1613
|
+
<td>
|
1614
|
+
<pre class="lines">
|
1615
|
+
|
1616
|
+
|
1617
|
+
85
|
1618
|
+
86
|
1619
|
+
87
|
1620
|
+
88
|
1621
|
+
89
|
1622
|
+
90
|
1623
|
+
91</pre>
|
1624
|
+
</td>
|
1625
|
+
<td>
|
1626
|
+
<pre class="code"><span class="info file"># File 'lib/sprout/progress_bar.rb', line 85</span>
|
1627
|
+
|
1628
|
+
<span class='kw'>def</span> <span class='id fmt_stat_for_file_transfer'>fmt_stat_for_file_transfer</span>
|
1629
|
+
<span class='kw'>if</span> <span class='ivar'>@finished_p</span> <span class='kw'>then</span>
|
1630
|
+
<span class='id sprintf'>sprintf</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>%s %s %s</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='id bytes'>bytes</span><span class='comma'>,</span> <span class='id transfer_rate'>transfer_rate</span><span class='comma'>,</span> <span class='id elapsed'>elapsed</span><span class='rparen'>)</span>
|
1631
|
+
<span class='kw'>else</span>
|
1632
|
+
<span class='id sprintf'>sprintf</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>%s %s %s</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='id bytes'>bytes</span><span class='comma'>,</span> <span class='id transfer_rate'>transfer_rate</span><span class='comma'>,</span> <span class='id eta'>eta</span><span class='rparen'>)</span>
|
1633
|
+
<span class='kw'>end</span>
|
1634
|
+
<span class='kw'>end</span></pre>
|
1635
|
+
</td>
|
1636
|
+
</tr>
|
1637
|
+
</table>
|
1638
|
+
</div>
|
1639
|
+
|
1640
|
+
<div class="method_details ">
|
1641
|
+
<p class="signature " id="fmt_title-instance_method">
|
1642
|
+
|
1643
|
+
- (<tt>Object</tt>) <strong>fmt_title</strong>
|
1644
|
+
|
1645
|
+
|
1646
|
+
|
1647
|
+
</p><table class="source_code">
|
1648
|
+
<tr>
|
1649
|
+
<td>
|
1650
|
+
<pre class="lines">
|
1651
|
+
|
1652
|
+
|
1653
|
+
93
|
1654
|
+
94
|
1655
|
+
95</pre>
|
1656
|
+
</td>
|
1657
|
+
<td>
|
1658
|
+
<pre class="code"><span class="info file"># File 'lib/sprout/progress_bar.rb', line 93</span>
|
1659
|
+
|
1660
|
+
<span class='kw'>def</span> <span class='id fmt_title'>fmt_title</span>
|
1661
|
+
<span class='ivar'>@title</span><span class='lbracket'>[</span><span class='int'>0</span><span class='comma'>,</span><span class='lparen'>(</span><span class='ivar'>@title_width</span> <span class='op'>-</span> <span class='int'>1</span><span class='rparen'>)</span><span class='rbracket'>]</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>:</span><span class='tstring_end'>"</span></span>
|
1662
|
+
<span class='kw'>end</span></pre>
|
1663
|
+
</td>
|
1664
|
+
</tr>
|
1665
|
+
</table>
|
1666
|
+
</div>
|
1667
|
+
|
1668
|
+
<div class="method_details ">
|
1669
|
+
<p class="signature " id="format=-instance_method">
|
1670
|
+
|
1671
|
+
- (<tt>Object</tt>) <strong>format=</strong>(format)
|
1672
|
+
|
1673
|
+
|
1674
|
+
|
1675
|
+
</p><table class="source_code">
|
1676
|
+
<tr>
|
1677
|
+
<td>
|
1678
|
+
<pre class="lines">
|
1679
|
+
|
1680
|
+
|
1681
|
+
234
|
1682
|
+
235
|
1683
|
+
236</pre>
|
1684
|
+
</td>
|
1685
|
+
<td>
|
1686
|
+
<pre class="code"><span class="info file"># File 'lib/sprout/progress_bar.rb', line 234</span>
|
1687
|
+
|
1688
|
+
<span class='kw'>def</span> <span class='id format='>format=</span> <span class='lparen'>(</span><span class='id format'>format</span><span class='rparen'>)</span>
|
1689
|
+
<span class='ivar'>@format</span> <span class='op'>=</span> <span class='id format'>format</span>
|
1690
|
+
<span class='kw'>end</span></pre>
|
1691
|
+
</td>
|
1692
|
+
</tr>
|
1693
|
+
</table>
|
1694
|
+
</div>
|
1695
|
+
|
1696
|
+
<div class="method_details ">
|
1697
|
+
<p class="signature " id="format_arguments=-instance_method">
|
1698
|
+
|
1699
|
+
- (<tt>Object</tt>) <strong>format_arguments=</strong>(arguments)
|
1700
|
+
|
1701
|
+
|
1702
|
+
|
1703
|
+
</p><table class="source_code">
|
1704
|
+
<tr>
|
1705
|
+
<td>
|
1706
|
+
<pre class="lines">
|
1707
|
+
|
1708
|
+
|
1709
|
+
238
|
1710
|
+
239
|
1711
|
+
240</pre>
|
1712
|
+
</td>
|
1713
|
+
<td>
|
1714
|
+
<pre class="code"><span class="info file"># File 'lib/sprout/progress_bar.rb', line 238</span>
|
1715
|
+
|
1716
|
+
<span class='kw'>def</span> <span class='id format_arguments='>format_arguments=</span> <span class='lparen'>(</span><span class='id arguments'>arguments</span><span class='rparen'>)</span>
|
1717
|
+
<span class='ivar'>@format_arguments</span> <span class='op'>=</span> <span class='id arguments'>arguments</span>
|
1718
|
+
<span class='kw'>end</span></pre>
|
1719
|
+
</td>
|
1720
|
+
</tr>
|
1721
|
+
</table>
|
1722
|
+
</div>
|
1723
|
+
|
1724
|
+
<div class="method_details ">
|
1725
|
+
<p class="signature " id="format_time-instance_method">
|
1726
|
+
|
1727
|
+
- (<tt>Object</tt>) <strong>format_time</strong>(t)
|
1728
|
+
|
1729
|
+
|
1730
|
+
|
1731
|
+
</p><table class="source_code">
|
1732
|
+
<tr>
|
1733
|
+
<td>
|
1734
|
+
<pre class="lines">
|
1735
|
+
|
1736
|
+
|
1737
|
+
118
|
1738
|
+
119
|
1739
|
+
120
|
1740
|
+
121
|
1741
|
+
122
|
1742
|
+
123
|
1743
|
+
124</pre>
|
1744
|
+
</td>
|
1745
|
+
<td>
|
1746
|
+
<pre class="code"><span class="info file"># File 'lib/sprout/progress_bar.rb', line 118</span>
|
1747
|
+
|
1748
|
+
<span class='kw'>def</span> <span class='id format_time'>format_time</span> <span class='lparen'>(</span><span class='id t'>t</span><span class='rparen'>)</span>
|
1749
|
+
<span class='id t'>t</span> <span class='op'>=</span> <span class='id t'>t</span><span class='period'>.</span><span class='id to_i'>to_i</span>
|
1750
|
+
<span class='id sec'>sec</span> <span class='op'>=</span> <span class='id t'>t</span> <span class='op'>%</span> <span class='int'>60</span>
|
1751
|
+
<span class='id min'>min</span> <span class='op'>=</span> <span class='lparen'>(</span><span class='id t'>t</span> <span class='op'>/</span> <span class='int'>60</span><span class='rparen'>)</span> <span class='op'>%</span> <span class='int'>60</span>
|
1752
|
+
<span class='id hour'>hour</span> <span class='op'>=</span> <span class='id t'>t</span> <span class='op'>/</span> <span class='int'>3600</span>
|
1753
|
+
<span class='id sprintf'>sprintf</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>%02d:%02d:%02d</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='id hour'>hour</span><span class='comma'>,</span> <span class='id min'>min</span><span class='comma'>,</span> <span class='id sec'>sec</span><span class='rparen'>)</span>
|
1754
|
+
<span class='kw'>end</span></pre>
|
1755
|
+
</td>
|
1756
|
+
</tr>
|
1757
|
+
</table>
|
1758
|
+
</div>
|
1759
|
+
|
1760
|
+
<div class="method_details ">
|
1761
|
+
<p class="signature " id="get_width-instance_method">
|
1762
|
+
|
1763
|
+
- (<tt>Object</tt>) <strong>get_width</strong>
|
1764
|
+
|
1765
|
+
|
1766
|
+
|
1767
|
+
</p><table class="source_code">
|
1768
|
+
<tr>
|
1769
|
+
<td>
|
1770
|
+
<pre class="lines">
|
1771
|
+
|
1772
|
+
|
1773
|
+
154
|
1774
|
+
155
|
1775
|
+
156
|
1776
|
+
157
|
1777
|
+
158
|
1778
|
+
159
|
1779
|
+
160
|
1780
|
+
161
|
1781
|
+
162
|
1782
|
+
163
|
1783
|
+
164
|
1784
|
+
165
|
1785
|
+
166
|
1786
|
+
167
|
1787
|
+
168
|
1788
|
+
169
|
1789
|
+
170
|
1790
|
+
171
|
1791
|
+
172
|
1792
|
+
173
|
1793
|
+
174</pre>
|
1794
|
+
</td>
|
1795
|
+
<td>
|
1796
|
+
<pre class="code"><span class="info file"># File 'lib/sprout/progress_bar.rb', line 154</span>
|
1797
|
+
|
1798
|
+
<span class='kw'>def</span> <span class='id get_width'>get_width</span>
|
1799
|
+
<span class='comment'># return 80
|
1800
|
+
</span> <span class='comment'># FIXME: I don't know how portable it is.
|
1801
|
+
</span> <span class='id default_width'>default_width</span> <span class='op'>=</span> <span class='int'>80</span>
|
1802
|
+
<span class='kw'>begin</span>
|
1803
|
+
<span class='id tiocgwinsz'>tiocgwinsz</span> <span class='op'>=</span> <span class='int'>0x5413</span>
|
1804
|
+
<span class='id data'>data</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='int'>0</span><span class='comma'>,</span> <span class='int'>0</span><span class='comma'>,</span> <span class='int'>0</span><span class='comma'>,</span> <span class='int'>0</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id pack'>pack</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>SSSS</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
1805
|
+
<span class='kw'>if</span> <span class='ivar'>@out</span><span class='period'>.</span><span class='id ioctl'>ioctl</span><span class='lparen'>(</span><span class='id tiocgwinsz'>tiocgwinsz</span><span class='comma'>,</span> <span class='id data'>data</span><span class='rparen'>)</span> <span class='op'>>=</span> <span class='int'>0</span> <span class='kw'>then</span>
|
1806
|
+
<span class='id unpacked'>unpacked</span> <span class='op'>=</span> <span class='id data'>data</span><span class='period'>.</span><span class='id unpack'>unpack</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>SSSS</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
1807
|
+
<span class='id cols'>cols</span> <span class='op'>=</span> <span class='id unpacked'>unpacked</span><span class='lbracket'>[</span><span class='int'>1</span><span class='rbracket'>]</span>
|
1808
|
+
<span class='comment'># Commented this because Aptana was complaining about
|
1809
|
+
</span> <span class='comment'># The unused variables
|
1810
|
+
</span> <span class='comment'># rows, cols, xpixels, ypixels = data.unpack("SSSS")
|
1811
|
+
</span> <span class='kw'>if</span> <span class='id cols'>cols</span> <span class='op'>>=</span> <span class='int'>0</span> <span class='kw'>then</span> <span class='id cols'>cols</span> <span class='kw'>else</span> <span class='id default_width'>default_width</span> <span class='kw'>end</span>
|
1812
|
+
<span class='kw'>else</span>
|
1813
|
+
<span class='id default_width'>default_width</span>
|
1814
|
+
<span class='kw'>end</span>
|
1815
|
+
<span class='kw'>rescue</span> <span class='const'>Exception</span>
|
1816
|
+
<span class='id default_width'>default_width</span>
|
1817
|
+
<span class='kw'>end</span>
|
1818
|
+
<span class='kw'>end</span></pre>
|
1819
|
+
</td>
|
1820
|
+
</tr>
|
1821
|
+
</table>
|
1822
|
+
</div>
|
1823
|
+
|
1824
|
+
<div class="method_details ">
|
1825
|
+
<p class="signature " id="halt-instance_method">
|
1826
|
+
|
1827
|
+
- (<tt>Object</tt>) <strong>halt</strong>
|
1828
|
+
|
1829
|
+
|
1830
|
+
|
1831
|
+
</p><table class="source_code">
|
1832
|
+
<tr>
|
1833
|
+
<td>
|
1834
|
+
<pre class="lines">
|
1835
|
+
|
1836
|
+
|
1837
|
+
242
|
1838
|
+
243
|
1839
|
+
244
|
1840
|
+
245</pre>
|
1841
|
+
</td>
|
1842
|
+
<td>
|
1843
|
+
<pre class="code"><span class="info file"># File 'lib/sprout/progress_bar.rb', line 242</span>
|
1844
|
+
|
1845
|
+
<span class='kw'>def</span> <span class='id halt'>halt</span>
|
1846
|
+
<span class='ivar'>@finished_p</span> <span class='op'>=</span> <span class='kw'>true</span>
|
1847
|
+
<span class='id show'>show</span>
|
1848
|
+
<span class='kw'>end</span></pre>
|
1849
|
+
</td>
|
1850
|
+
</tr>
|
1851
|
+
</table>
|
1852
|
+
</div>
|
1853
|
+
|
1854
|
+
<div class="method_details ">
|
1855
|
+
<p class="signature " id="inc-instance_method">
|
1856
|
+
|
1857
|
+
- (<tt>Object</tt>) <strong>inc</strong>(step = 1)
|
1858
|
+
|
1859
|
+
|
1860
|
+
|
1861
|
+
</p><table class="source_code">
|
1862
|
+
<tr>
|
1863
|
+
<td>
|
1864
|
+
<pre class="lines">
|
1865
|
+
|
1866
|
+
|
1867
|
+
247
|
1868
|
+
248
|
1869
|
+
249
|
1870
|
+
250
|
1871
|
+
251
|
1872
|
+
252</pre>
|
1873
|
+
</td>
|
1874
|
+
<td>
|
1875
|
+
<pre class="code"><span class="info file"># File 'lib/sprout/progress_bar.rb', line 247</span>
|
1876
|
+
|
1877
|
+
<span class='kw'>def</span> <span class='id inc'>inc</span> <span class='lparen'>(</span><span class='id step'>step</span> <span class='op'>=</span> <span class='int'>1</span><span class='rparen'>)</span>
|
1878
|
+
<span class='ivar'>@current</span> <span class='op'>+=</span> <span class='id step'>step</span>
|
1879
|
+
<span class='ivar'>@current</span> <span class='op'>=</span> <span class='ivar'>@total</span> <span class='kw'>if</span> <span class='ivar'>@current</span> <span class='op'>></span> <span class='ivar'>@total</span>
|
1880
|
+
<span class='id show_if_needed'>show_if_needed</span>
|
1881
|
+
<span class='ivar'>@previous</span> <span class='op'>=</span> <span class='ivar'>@current</span>
|
1882
|
+
<span class='kw'>end</span></pre>
|
1883
|
+
</td>
|
1884
|
+
</tr>
|
1885
|
+
</table>
|
1886
|
+
</div>
|
1887
|
+
|
1888
|
+
<div class="method_details ">
|
1889
|
+
<p class="signature " id="inspect-instance_method">
|
1890
|
+
|
1891
|
+
- (<tt>Object</tt>) <strong>inspect</strong>
|
1892
|
+
|
1893
|
+
|
1894
|
+
|
1895
|
+
</p><table class="source_code">
|
1896
|
+
<tr>
|
1897
|
+
<td>
|
1898
|
+
<pre class="lines">
|
1899
|
+
|
1900
|
+
|
1901
|
+
263
|
1902
|
+
264
|
1903
|
+
265</pre>
|
1904
|
+
</td>
|
1905
|
+
<td>
|
1906
|
+
<pre class="code"><span class="info file"># File 'lib/sprout/progress_bar.rb', line 263</span>
|
1907
|
+
|
1908
|
+
<span class='kw'>def</span> <span class='id inspect'>inspect</span>
|
1909
|
+
<span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>#<ProgressBar:</span><span class='embexpr_beg'>#{</span><span class='ivar'>@current</span><span class='rbrace'>}</span><span class='tstring_content'>/</span><span class='embexpr_beg'>#{</span><span class='ivar'>@total</span><span class='rbrace'>}</span><span class='tstring_content'>></span><span class='tstring_end'>"</span></span>
|
1910
|
+
<span class='kw'>end</span></pre>
|
1911
|
+
</td>
|
1912
|
+
</tr>
|
1913
|
+
</table>
|
1914
|
+
</div>
|
1915
|
+
|
1916
|
+
<div class="method_details ">
|
1917
|
+
<p class="signature " id="set-instance_method">
|
1918
|
+
|
1919
|
+
- (<tt>Object</tt>) <strong>set</strong>(count)
|
1920
|
+
|
1921
|
+
|
1922
|
+
|
1923
|
+
</p><table class="source_code">
|
1924
|
+
<tr>
|
1925
|
+
<td>
|
1926
|
+
<pre class="lines">
|
1927
|
+
|
1928
|
+
|
1929
|
+
254
|
1930
|
+
255
|
1931
|
+
256
|
1932
|
+
257
|
1933
|
+
258
|
1934
|
+
259
|
1935
|
+
260
|
1936
|
+
261</pre>
|
1937
|
+
</td>
|
1938
|
+
<td>
|
1939
|
+
<pre class="code"><span class="info file"># File 'lib/sprout/progress_bar.rb', line 254</span>
|
1940
|
+
|
1941
|
+
<span class='kw'>def</span> <span class='id set'>set</span> <span class='lparen'>(</span><span class='id count'>count</span><span class='rparen'>)</span>
|
1942
|
+
<span class='kw'>if</span> <span class='id count'>count</span> <span class='op'><</span> <span class='int'>0</span> <span class='op'>||</span> <span class='id count'>count</span> <span class='op'>></span> <span class='ivar'>@total</span>
|
1943
|
+
<span class='ivar'>@total</span> <span class='op'>=</span> <span class='id count'>count</span>
|
1944
|
+
<span class='kw'>end</span>
|
1945
|
+
<span class='ivar'>@current</span> <span class='op'>=</span> <span class='id count'>count</span>
|
1946
|
+
<span class='id show_if_needed'>show_if_needed</span>
|
1947
|
+
<span class='ivar'>@previous</span> <span class='op'>=</span> <span class='ivar'>@current</span>
|
1948
|
+
<span class='kw'>end</span></pre>
|
1949
|
+
</td>
|
1950
|
+
</tr>
|
1951
|
+
</table>
|
1952
|
+
</div>
|
1953
|
+
|
1954
|
+
<div class="method_details ">
|
1955
|
+
<p class="signature " id="show-instance_method">
|
1956
|
+
|
1957
|
+
- (<tt>Object</tt>) <strong>show</strong>
|
1958
|
+
|
1959
|
+
|
1960
|
+
|
1961
|
+
</p><table class="source_code">
|
1962
|
+
<tr>
|
1963
|
+
<td>
|
1964
|
+
<pre class="lines">
|
1965
|
+
|
1966
|
+
|
1967
|
+
176
|
1968
|
+
177
|
1969
|
+
178
|
1970
|
+
179
|
1971
|
+
180
|
1972
|
+
181
|
1973
|
+
182
|
1974
|
+
183
|
1975
|
+
184
|
1976
|
+
185
|
1977
|
+
186
|
1978
|
+
187
|
1979
|
+
188
|
1980
|
+
189
|
1981
|
+
190
|
1982
|
+
191
|
1983
|
+
192
|
1984
|
+
193
|
1985
|
+
194
|
1986
|
+
195</pre>
|
1987
|
+
</td>
|
1988
|
+
<td>
|
1989
|
+
<pre class="code"><span class="info file"># File 'lib/sprout/progress_bar.rb', line 176</span>
|
1990
|
+
|
1991
|
+
<span class='kw'>def</span> <span class='id show'>show</span>
|
1992
|
+
<span class='id arguments'>arguments</span> <span class='op'>=</span> <span class='ivar'>@format_arguments</span><span class='period'>.</span><span class='id map'>map</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id method'>method</span><span class='op'>|</span>
|
1993
|
+
<span class='id method'>method</span> <span class='op'>=</span> <span class='id sprintf'>sprintf</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>fmt_%s</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='id method'>method</span><span class='rparen'>)</span>
|
1994
|
+
<span class='id send'>send</span><span class='lparen'>(</span><span class='id method'>method</span><span class='rparen'>)</span>
|
1995
|
+
<span class='kw'>end</span>
|
1996
|
+
<span class='id line'>line</span> <span class='op'>=</span> <span class='id sprintf'>sprintf</span><span class='lparen'>(</span><span class='ivar'>@format</span><span class='comma'>,</span> <span class='op'>*</span><span class='id arguments'>arguments</span><span class='rparen'>)</span>
|
1997
|
+
|
1998
|
+
<span class='id width'>width</span> <span class='op'>=</span> <span class='id get_width'>get_width</span>
|
1999
|
+
<span class='kw'>if</span><span class='lparen'>(</span><span class='id line'>line</span><span class='period'>.</span><span class='id length'>length</span> <span class='op'>==</span> <span class='id width'>width</span> <span class='op'>-</span> <span class='int'>1</span><span class='rparen'>)</span>
|
2000
|
+
<span class='ivar'>@out</span><span class='period'>.</span><span class='id print'>print</span><span class='lparen'>(</span><span class='id line'>line</span> <span class='op'>+</span> <span class='id eol'>eol</span><span class='rparen'>)</span>
|
2001
|
+
<span class='ivar'>@out</span><span class='period'>.</span><span class='id flush'>flush</span>
|
2002
|
+
<span class='kw'>elsif</span><span class='lparen'>(</span><span class='id line'>line</span><span class='period'>.</span><span class='id length'>length</span> <span class='op'>>=</span> <span class='id width'>width</span><span class='rparen'>)</span>
|
2003
|
+
<span class='ivar'>@terminal_width</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='ivar'>@terminal_width</span> <span class='op'>-</span> <span class='lparen'>(</span><span class='id line'>line</span><span class='period'>.</span><span class='id length'>length</span> <span class='op'>-</span> <span class='id width'>width</span> <span class='op'>+</span> <span class='int'>1</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='int'>0</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id max'>max</span>
|
2004
|
+
<span class='kw'>if</span> <span class='ivar'>@terminal_width</span> <span class='op'>==</span> <span class='int'>0</span> <span class='kw'>then</span> <span class='ivar'>@out</span><span class='period'>.</span><span class='id print'>print</span><span class='lparen'>(</span><span class='id line'>line</span> <span class='op'>+</span> <span class='id eol'>eol</span><span class='rparen'>)</span> <span class='kw'>else</span> <span class='id show'>show</span> <span class='kw'>end</span>
|
2005
|
+
<span class='kw'>else</span> <span class='comment'># line.length < width - 1
|
2006
|
+
</span> <span class='ivar'>@terminal_width</span> <span class='op'>+=</span> <span class='id width'>width</span> <span class='op'>-</span> <span class='id line'>line</span><span class='period'>.</span><span class='id length'>length</span> <span class='op'>+</span> <span class='int'>1</span>
|
2007
|
+
<span class='id show'>show</span>
|
2008
|
+
<span class='kw'>end</span>
|
2009
|
+
<span class='ivar'>@previous_time</span> <span class='op'>=</span> <span class='const'>Time</span><span class='period'>.</span><span class='id now'>now</span>
|
2010
|
+
<span class='kw'>end</span></pre>
|
2011
|
+
</td>
|
2012
|
+
</tr>
|
2013
|
+
</table>
|
2014
|
+
</div>
|
2015
|
+
|
2016
|
+
<div class="method_details ">
|
2017
|
+
<p class="signature " id="show_if_needed-instance_method">
|
2018
|
+
|
2019
|
+
- (<tt>Object</tt>) <strong>show_if_needed</strong>
|
2020
|
+
|
2021
|
+
|
2022
|
+
|
2023
|
+
</p><table class="source_code">
|
2024
|
+
<tr>
|
2025
|
+
<td>
|
2026
|
+
<pre class="lines">
|
2027
|
+
|
2028
|
+
|
2029
|
+
197
|
2030
|
+
198
|
2031
|
+
199
|
2032
|
+
200
|
2033
|
+
201
|
2034
|
+
202
|
2035
|
+
203
|
2036
|
+
204
|
2037
|
+
205
|
2038
|
+
206
|
2039
|
+
207
|
2040
|
+
208
|
2041
|
+
209
|
2042
|
+
210
|
2043
|
+
211</pre>
|
2044
|
+
</td>
|
2045
|
+
<td>
|
2046
|
+
<pre class="code"><span class="info file"># File 'lib/sprout/progress_bar.rb', line 197</span>
|
2047
|
+
|
2048
|
+
<span class='kw'>def</span> <span class='id show_if_needed'>show_if_needed</span>
|
2049
|
+
<span class='kw'>if</span> <span class='ivar'>@total</span><span class='period'>.</span><span class='id zero?'>zero?</span>
|
2050
|
+
<span class='id cur_percentage'>cur_percentage</span> <span class='op'>=</span> <span class='int'>100</span>
|
2051
|
+
<span class='id prev_percentage'>prev_percentage</span> <span class='op'>=</span> <span class='int'>0</span>
|
2052
|
+
<span class='kw'>else</span>
|
2053
|
+
<span class='id cur_percentage'>cur_percentage</span> <span class='op'>=</span> <span class='lparen'>(</span><span class='ivar'>@current</span> <span class='op'>*</span> <span class='int'>100</span> <span class='op'>/</span> <span class='ivar'>@total</span><span class='rparen'>)</span><span class='period'>.</span><span class='id to_i'>to_i</span>
|
2054
|
+
<span class='id prev_percentage'>prev_percentage</span> <span class='op'>=</span> <span class='lparen'>(</span><span class='ivar'>@previous</span> <span class='op'>*</span> <span class='int'>100</span> <span class='op'>/</span> <span class='ivar'>@total</span><span class='rparen'>)</span><span class='period'>.</span><span class='id to_i'>to_i</span>
|
2055
|
+
<span class='kw'>end</span>
|
2056
|
+
|
2057
|
+
<span class='comment'># Use "!=" instead of ">" to support negative changes
|
2058
|
+
</span> <span class='kw'>if</span> <span class='id cur_percentage'>cur_percentage</span> <span class='op'>!=</span> <span class='id prev_percentage'>prev_percentage</span> <span class='op'>||</span>
|
2059
|
+
<span class='const'>Time</span><span class='period'>.</span><span class='id now'>now</span> <span class='op'>-</span> <span class='ivar'>@previous_time</span> <span class='op'>>=</span> <span class='int'>1</span> <span class='op'>||</span> <span class='ivar'>@finished_p</span>
|
2060
|
+
<span class='id show'>show</span>
|
2061
|
+
<span class='kw'>end</span>
|
2062
|
+
<span class='kw'>end</span></pre>
|
2063
|
+
</td>
|
2064
|
+
</tr>
|
2065
|
+
</table>
|
2066
|
+
</div>
|
2067
|
+
|
2068
|
+
<div class="method_details ">
|
2069
|
+
<p class="signature " id="transfer_rate-instance_method">
|
2070
|
+
|
2071
|
+
- (<tt>Object</tt>) <strong>transfer_rate</strong>
|
2072
|
+
|
2073
|
+
|
2074
|
+
|
2075
|
+
</p><table class="source_code">
|
2076
|
+
<tr>
|
2077
|
+
<td>
|
2078
|
+
<pre class="lines">
|
2079
|
+
|
2080
|
+
|
2081
|
+
109
|
2082
|
+
110
|
2083
|
+
111
|
2084
|
+
112</pre>
|
2085
|
+
</td>
|
2086
|
+
<td>
|
2087
|
+
<pre class="code"><span class="info file"># File 'lib/sprout/progress_bar.rb', line 109</span>
|
2088
|
+
|
2089
|
+
<span class='kw'>def</span> <span class='id transfer_rate'>transfer_rate</span>
|
2090
|
+
<span class='id bytes_per_second'>bytes_per_second</span> <span class='op'>=</span> <span class='ivar'>@current</span><span class='period'>.</span><span class='id to_f'>to_f</span> <span class='op'>/</span> <span class='lparen'>(</span><span class='const'>Time</span><span class='period'>.</span><span class='id now'>now</span> <span class='op'>-</span> <span class='ivar'>@start_time</span><span class='rparen'>)</span>
|
2091
|
+
<span class='id sprintf'>sprintf</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>%s/s</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='id convert_bytes'>convert_bytes</span><span class='lparen'>(</span><span class='id bytes_per_second'>bytes_per_second</span><span class='rparen'>)</span><span class='rparen'>)</span>
|
2092
|
+
<span class='kw'>end</span></pre>
|
2093
|
+
</td>
|
2094
|
+
</tr>
|
2095
|
+
</table>
|
2096
|
+
</div>
|
2097
|
+
|
2098
|
+
</div>
|
2099
|
+
|
2100
|
+
</div>
|
2101
|
+
|
2102
|
+
<div id="footer">
|
2103
|
+
Generated on Fri Apr 29 18:33:06 2011 by
|
2104
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
2105
|
+
0.6.3 (ruby-1.9.2).
|
2106
|
+
</div>
|
2107
|
+
|
2108
|
+
</body>
|
2109
|
+
</html>
|