sprout 1.0.35.pre → 1.1.2.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.

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