rpub 0.4.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +1 -1
- data/.rspec +0 -1
- data/.travis.yml +3 -4
- data/.yardopts +1 -0
- data/Gemfile +1 -1
- data/Gemfile.lock +70 -46
- data/Guardfile +6 -0
- data/HISTORY.md +10 -0
- data/README.md +1 -1
- data/Rakefile +7 -2
- data/bin/rpub +64 -1
- data/doc/.gitignore +8 -0
- data/doc/api/Rpub.html +339 -0
- data/doc/api/Rpub/Book.html +983 -0
- data/doc/api/Rpub/Chapter.html +737 -0
- data/doc/api/Rpub/Command.html +356 -0
- data/doc/api/Rpub/Commands.html +117 -0
- data/doc/api/Rpub/Commands/Clean.html +216 -0
- data/doc/api/Rpub/Commands/Compile.html +218 -0
- data/doc/api/Rpub/Commands/Generate.html +242 -0
- data/doc/api/Rpub/Commands/Package.html +230 -0
- data/doc/api/Rpub/Commands/Preview.html +216 -0
- data/doc/api/Rpub/Commands/Stats.html +226 -0
- data/doc/api/Rpub/Compressor.html +687 -0
- data/doc/api/Rpub/Context.html +553 -0
- data/doc/api/Rpub/Document.html +647 -0
- data/doc/api/Rpub/Document/OutlineElement.html +388 -0
- data/doc/api/Rpub/Epub.html +465 -0
- data/doc/api/Rpub/Epub/Container.html +224 -0
- data/doc/api/Rpub/Epub/Content.html +344 -0
- data/doc/api/Rpub/Epub/Cover.html +236 -0
- data/doc/api/Rpub/Epub/HtmlToc.html +240 -0
- data/doc/api/Rpub/Epub/Toc.html +244 -0
- data/doc/api/Rpub/FilesystemSource.html +544 -0
- data/doc/api/Rpub/HashDelegation.html +281 -0
- data/doc/api/Rpub/HashDelegation/ClassMethods.html +175 -0
- data/doc/api/Rpub/MediaType.html +192 -0
- data/doc/api/Rpub/Preview.html +464 -0
- data/doc/api/Rpub/XmlFile.html +457 -0
- data/doc/api/_index.html +405 -0
- data/doc/api/class_list.html +54 -0
- data/doc/api/css/common.css +1 -0
- data/doc/api/css/full_list.css +57 -0
- data/doc/api/css/style.css +339 -0
- data/doc/api/file.HISTORY.html +131 -0
- data/doc/api/file.LICENSE.html +92 -0
- data/doc/api/file.README.html +337 -0
- data/doc/api/file_list.html +62 -0
- data/doc/api/frames.html +26 -0
- data/doc/api/index.html +337 -0
- data/doc/api/js/app.js +219 -0
- data/doc/api/js/full_list.js +178 -0
- data/doc/api/js/jquery.js +4 -0
- data/doc/api/method_list.html +533 -0
- data/doc/api/top-level-namespace.html +112 -0
- data/doc/index.html +312 -0
- data/doc/javascripts/scale.fix.js +17 -0
- data/doc/params.json +1 -0
- data/doc/stylesheets/pygment_trac.css +69 -0
- data/doc/stylesheets/styles.css +255 -0
- data/features/clean.feature +31 -0
- data/features/compile.feature +49 -0
- data/features/embedded_assets.feature +51 -0
- data/features/generate.feature +63 -0
- data/features/layout.feature +41 -0
- data/features/package.feature +30 -0
- data/features/previews.feature +66 -0
- data/features/stats.feature +18 -0
- data/features/step_definitions/general_steps.rb +60 -0
- data/features/styles.feature +33 -0
- data/features/support/env.rb +7 -0
- data/features/table_of_contents.feature +35 -0
- data/lib/rpub.rb +28 -31
- data/lib/rpub/book.rb +9 -16
- data/lib/rpub/chapter.rb +4 -54
- data/lib/rpub/command.rb +32 -0
- data/lib/rpub/commands/clean.rb +4 -49
- data/lib/rpub/commands/compile.rb +4 -49
- data/lib/rpub/commands/generate.rb +10 -67
- data/lib/rpub/commands/package.rb +9 -37
- data/lib/rpub/commands/preview.rb +4 -54
- data/lib/rpub/commands/stats.rb +6 -10
- data/lib/rpub/compressor.rb +3 -3
- data/lib/rpub/context.rb +48 -0
- data/lib/rpub/document.rb +68 -0
- data/lib/rpub/epub.rb +8 -7
- data/lib/rpub/epub/content.rb +9 -30
- data/lib/rpub/epub/cover.rb +1 -8
- data/lib/rpub/epub/html_toc.rb +4 -9
- data/lib/rpub/epub/toc.rb +16 -13
- data/lib/rpub/filesystem_source.rb +47 -0
- data/lib/rpub/media_type.rb +16 -0
- data/lib/rpub/preview.rb +29 -0
- data/lib/rpub/version.rb +1 -1
- data/lib/rpub/xml_file.rb +4 -1
- data/rpub.gemspec +6 -7
- data/spec/rpub/book_spec.rb +45 -45
- data/spec/rpub/chapter_spec.rb +87 -22
- data/spec/rpub/epub/container_spec.rb +3 -5
- data/spec/rpub/epub/content_spec.rb +62 -41
- data/spec/rpub/epub/cover_spec.rb +3 -5
- data/spec/rpub/epub/html_toc_spec.rb +8 -8
- data/spec/rpub/epub/toc_spec.rb +20 -22
- data/spec/rpub_spec.rb +1 -3
- data/spec/spec_helper.rb +28 -0
- data/support/config.yml +1 -0
- data/support/styles.css +3 -3
- metadata +131 -120
- data/lib/rpub/commander.rb +0 -23
- data/lib/rpub/commands/base.rb +0 -33
- data/lib/rpub/commands/help.rb +0 -37
- data/lib/rpub/commands/main.rb +0 -45
- data/lib/rpub/compilation_helpers.rb +0 -73
- data/lib/rpub/subclass_tracker.rb +0 -53
- data/spec/rpub/commands/clean_spec.rb +0 -46
- data/spec/rpub/commands/generate_spec.rb +0 -52
- data/spec/rpub/commands/main_spec.rb +0 -26
- data/spec/rpub/commands/package_spec.rb +0 -33
- data/spec/rpub/commands/preview_spec.rb +0 -43
@@ -0,0 +1,687 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
4
|
+
<head>
|
5
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
6
|
+
<title>
|
7
|
+
Class: Rpub::Compressor
|
8
|
+
|
9
|
+
— Rpub, a simple ePub generator library in Ruby
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="../css/style.css" type="text/css" charset="utf-8" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="../css/common.css" type="text/css" charset="utf-8" />
|
16
|
+
|
17
|
+
<script type="text/javascript" charset="utf-8">
|
18
|
+
hasFrames = window.top.frames.main ? true : false;
|
19
|
+
relpath = '../';
|
20
|
+
framesUrl = "../frames.html#!Rpub/Compressor.html";
|
21
|
+
</script>
|
22
|
+
|
23
|
+
|
24
|
+
<script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
|
25
|
+
|
26
|
+
<script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
|
27
|
+
|
28
|
+
|
29
|
+
</head>
|
30
|
+
<body>
|
31
|
+
<div id="header">
|
32
|
+
<div id="menu">
|
33
|
+
|
34
|
+
<a href="../_index.html">Index (C)</a> »
|
35
|
+
<span class='title'><span class='object_link'><a href="../Rpub.html" title="Rpub (module)">Rpub</a></span></span>
|
36
|
+
»
|
37
|
+
<span class="title">Compressor</span>
|
38
|
+
|
39
|
+
|
40
|
+
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
|
41
|
+
</div>
|
42
|
+
|
43
|
+
<div id="search">
|
44
|
+
|
45
|
+
<a class="full_list_link" id="class_list_link"
|
46
|
+
href="../class_list.html">
|
47
|
+
Class List
|
48
|
+
</a>
|
49
|
+
|
50
|
+
<a class="full_list_link" id="method_list_link"
|
51
|
+
href="../method_list.html">
|
52
|
+
Method List
|
53
|
+
</a>
|
54
|
+
|
55
|
+
<a class="full_list_link" id="file_list_link"
|
56
|
+
href="../file_list.html">
|
57
|
+
File List
|
58
|
+
</a>
|
59
|
+
|
60
|
+
</div>
|
61
|
+
<div class="clear"></div>
|
62
|
+
</div>
|
63
|
+
|
64
|
+
<iframe id="search_frame"></iframe>
|
65
|
+
|
66
|
+
<div id="content"><h1>Class: Rpub::Compressor
|
67
|
+
|
68
|
+
|
69
|
+
|
70
|
+
</h1>
|
71
|
+
|
72
|
+
<dl class="box">
|
73
|
+
|
74
|
+
<dt class="r1">Inherits:</dt>
|
75
|
+
<dd class="r1">
|
76
|
+
<span class="inheritName">Object</span>
|
77
|
+
|
78
|
+
<ul class="fullTree">
|
79
|
+
<li>Object</li>
|
80
|
+
|
81
|
+
<li class="next">Rpub::Compressor</li>
|
82
|
+
|
83
|
+
</ul>
|
84
|
+
<a href="#" class="inheritanceTree">show all</a>
|
85
|
+
|
86
|
+
</dd>
|
87
|
+
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
|
96
|
+
<dt class="r2 last">Defined in:</dt>
|
97
|
+
<dd class="r2 last">lib/rpub/compressor.rb</dd>
|
98
|
+
|
99
|
+
</dl>
|
100
|
+
<div class="clear"></div>
|
101
|
+
|
102
|
+
<h2>Overview</h2><div class="docstring">
|
103
|
+
<div class="discussion">
|
104
|
+
<p>Wrapper around a +ZipOutputStream+ object provided by the +rubyzip+ gem.
|
105
|
+
This writes string contents straight into a zip file, without first saving
|
106
|
+
them to disk.</p>
|
107
|
+
|
108
|
+
|
109
|
+
</div>
|
110
|
+
</div>
|
111
|
+
<div class="tags">
|
112
|
+
|
113
|
+
|
114
|
+
</div>
|
115
|
+
|
116
|
+
|
117
|
+
|
118
|
+
<h2>Instance Attribute Summary <small>(<a href="#" class="summary_toggle">collapse</a>)</small></h2>
|
119
|
+
<ul class="summary">
|
120
|
+
|
121
|
+
<li class="public ">
|
122
|
+
<span class="summary_signature">
|
123
|
+
|
124
|
+
<a href="#zip-instance_method" title="#zip (instance method)">- (ZipOutputStream) <strong>zip</strong> </a>
|
125
|
+
|
126
|
+
|
127
|
+
|
128
|
+
</span>
|
129
|
+
|
130
|
+
|
131
|
+
|
132
|
+
|
133
|
+
<span class="note title readonly">readonly</span>
|
134
|
+
|
135
|
+
|
136
|
+
|
137
|
+
|
138
|
+
|
139
|
+
|
140
|
+
|
141
|
+
|
142
|
+
|
143
|
+
<span class="summary_desc"><div class='inline'>
|
144
|
+
</div></span>
|
145
|
+
|
146
|
+
</li>
|
147
|
+
|
148
|
+
|
149
|
+
</ul>
|
150
|
+
|
151
|
+
|
152
|
+
|
153
|
+
|
154
|
+
|
155
|
+
<h2>
|
156
|
+
Class Method Summary
|
157
|
+
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
|
158
|
+
</h2>
|
159
|
+
|
160
|
+
<ul class="summary">
|
161
|
+
|
162
|
+
<li class="public ">
|
163
|
+
<span class="summary_signature">
|
164
|
+
|
165
|
+
<a href="#open-class_method" title="open (class method)">+ (Object) <strong>open</strong>(filename) {|compressor| ... }</a>
|
166
|
+
|
167
|
+
|
168
|
+
|
169
|
+
</span>
|
170
|
+
|
171
|
+
|
172
|
+
|
173
|
+
|
174
|
+
|
175
|
+
|
176
|
+
|
177
|
+
|
178
|
+
|
179
|
+
<span class="summary_desc"><div class='inline'><p>Convenience method for opening a stream, allowing content to be written and finally closing the stream again.</p>
|
180
|
+
</div></span>
|
181
|
+
|
182
|
+
</li>
|
183
|
+
|
184
|
+
|
185
|
+
</ul>
|
186
|
+
|
187
|
+
<h2>
|
188
|
+
Instance Method Summary
|
189
|
+
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
|
190
|
+
</h2>
|
191
|
+
|
192
|
+
<ul class="summary">
|
193
|
+
|
194
|
+
<li class="public ">
|
195
|
+
<span class="summary_signature">
|
196
|
+
|
197
|
+
<a href="#close-instance_method" title="#close (instance method)">- (Object) <strong>close</strong> </a>
|
198
|
+
|
199
|
+
|
200
|
+
|
201
|
+
</span>
|
202
|
+
|
203
|
+
|
204
|
+
|
205
|
+
|
206
|
+
|
207
|
+
|
208
|
+
|
209
|
+
|
210
|
+
|
211
|
+
<span class="summary_desc"><div class='inline'><p>Close the zip stream and write the file to disk.</p>
|
212
|
+
</div></span>
|
213
|
+
|
214
|
+
</li>
|
215
|
+
|
216
|
+
|
217
|
+
<li class="public ">
|
218
|
+
<span class="summary_signature">
|
219
|
+
|
220
|
+
<a href="#compress_file-instance_method" title="#compress_file (instance method)">- (Object) <strong>compress_file</strong>(filename, content) </a>
|
221
|
+
|
222
|
+
|
223
|
+
|
224
|
+
</span>
|
225
|
+
|
226
|
+
|
227
|
+
|
228
|
+
|
229
|
+
|
230
|
+
|
231
|
+
|
232
|
+
|
233
|
+
|
234
|
+
<span class="summary_desc"><div class='inline'><p>Store a file with maximum compression in the archive.</p>
|
235
|
+
</div></span>
|
236
|
+
|
237
|
+
</li>
|
238
|
+
|
239
|
+
|
240
|
+
<li class="public ">
|
241
|
+
<span class="summary_signature">
|
242
|
+
|
243
|
+
<a href="#initialize-instance_method" title="#initialize (instance method)">- (Compressor) <strong>initialize</strong>(filename) </a>
|
244
|
+
|
245
|
+
|
246
|
+
|
247
|
+
</span>
|
248
|
+
|
249
|
+
|
250
|
+
<span class="note title constructor">constructor</span>
|
251
|
+
|
252
|
+
|
253
|
+
|
254
|
+
|
255
|
+
|
256
|
+
|
257
|
+
|
258
|
+
|
259
|
+
<span class="summary_desc"><div class='inline'><p>A new instance of Compressor.</p>
|
260
|
+
</div></span>
|
261
|
+
|
262
|
+
</li>
|
263
|
+
|
264
|
+
|
265
|
+
<li class="public ">
|
266
|
+
<span class="summary_signature">
|
267
|
+
|
268
|
+
<a href="#store_file-instance_method" title="#store_file (instance method)">- (Object) <strong>store_file</strong>(filename, content) </a>
|
269
|
+
|
270
|
+
|
271
|
+
|
272
|
+
</span>
|
273
|
+
|
274
|
+
|
275
|
+
|
276
|
+
|
277
|
+
|
278
|
+
|
279
|
+
|
280
|
+
|
281
|
+
|
282
|
+
<span class="summary_desc"><div class='inline'><p>Store a file in the archive without any compression.</p>
|
283
|
+
</div></span>
|
284
|
+
|
285
|
+
</li>
|
286
|
+
|
287
|
+
|
288
|
+
</ul>
|
289
|
+
|
290
|
+
|
291
|
+
<div id="constructor_details" class="method_details_list">
|
292
|
+
<h2>Constructor Details</h2>
|
293
|
+
|
294
|
+
<div class="method_details first">
|
295
|
+
<h3 class="signature first" id="initialize-instance_method">
|
296
|
+
|
297
|
+
- (<tt><span class='object_link'><a href="" title="Rpub::Compressor (class)">Compressor</a></span></tt>) <strong>initialize</strong>(filename)
|
298
|
+
|
299
|
+
|
300
|
+
|
301
|
+
|
302
|
+
|
303
|
+
</h3><div class="docstring">
|
304
|
+
<div class="discussion">
|
305
|
+
<p>Returns a new instance of Compressor</p>
|
306
|
+
|
307
|
+
|
308
|
+
</div>
|
309
|
+
</div>
|
310
|
+
<div class="tags">
|
311
|
+
<p class="tag_title">Parameters:</p>
|
312
|
+
<ul class="param">
|
313
|
+
|
314
|
+
<li>
|
315
|
+
|
316
|
+
<span class='name'>filename</span>
|
317
|
+
|
318
|
+
|
319
|
+
<span class='type'>(<tt>String</tt>)</span>
|
320
|
+
|
321
|
+
|
322
|
+
|
323
|
+
—
|
324
|
+
<div class='inline'><p>of the archive to write to disk</p>
|
325
|
+
</div>
|
326
|
+
|
327
|
+
</li>
|
328
|
+
|
329
|
+
</ul>
|
330
|
+
|
331
|
+
|
332
|
+
</div><table class="source_code">
|
333
|
+
<tr>
|
334
|
+
<td>
|
335
|
+
<pre class="lines">
|
336
|
+
|
337
|
+
|
338
|
+
19
|
339
|
+
20
|
340
|
+
21</pre>
|
341
|
+
</td>
|
342
|
+
<td>
|
343
|
+
<pre class="code"><span class="info file"># File 'lib/rpub/compressor.rb', line 19</span>
|
344
|
+
|
345
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_filename'>filename</span><span class='rparen'>)</span>
|
346
|
+
<span class='ivar'>@zip</span> <span class='op'>=</span> <span class='const'>Zip</span><span class='op'>::</span><span class='const'>OutputStream</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_filename'>filename</span><span class='rparen'>)</span>
|
347
|
+
<span class='kw'>end</span></pre>
|
348
|
+
</td>
|
349
|
+
</tr>
|
350
|
+
</table>
|
351
|
+
</div>
|
352
|
+
|
353
|
+
</div>
|
354
|
+
|
355
|
+
<div id="instance_attr_details" class="attr_details">
|
356
|
+
<h2>Instance Attribute Details</h2>
|
357
|
+
|
358
|
+
|
359
|
+
<span id=""></span>
|
360
|
+
<div class="method_details first">
|
361
|
+
<h3 class="signature first" id="zip-instance_method">
|
362
|
+
|
363
|
+
- (<tt>ZipOutputStream</tt>) <strong>zip</strong> <span class="extras">(readonly)</span>
|
364
|
+
|
365
|
+
|
366
|
+
|
367
|
+
|
368
|
+
|
369
|
+
</h3><div class="docstring">
|
370
|
+
<div class="discussion">
|
371
|
+
|
372
|
+
|
373
|
+
|
374
|
+
</div>
|
375
|
+
</div>
|
376
|
+
<div class="tags">
|
377
|
+
|
378
|
+
<p class="tag_title">Returns:</p>
|
379
|
+
<ul class="return">
|
380
|
+
|
381
|
+
<li>
|
382
|
+
|
383
|
+
|
384
|
+
<span class='type'>(<tt>ZipOutputStream</tt>)</span>
|
385
|
+
|
386
|
+
|
387
|
+
|
388
|
+
</li>
|
389
|
+
|
390
|
+
</ul>
|
391
|
+
|
392
|
+
</div><table class="source_code">
|
393
|
+
<tr>
|
394
|
+
<td>
|
395
|
+
<pre class="lines">
|
396
|
+
|
397
|
+
|
398
|
+
8
|
399
|
+
9
|
400
|
+
10</pre>
|
401
|
+
</td>
|
402
|
+
<td>
|
403
|
+
<pre class="code"><span class="info file"># File 'lib/rpub/compressor.rb', line 8</span>
|
404
|
+
|
405
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_zip'>zip</span>
|
406
|
+
<span class='ivar'>@zip</span>
|
407
|
+
<span class='kw'>end</span></pre>
|
408
|
+
</td>
|
409
|
+
</tr>
|
410
|
+
</table>
|
411
|
+
</div>
|
412
|
+
|
413
|
+
</div>
|
414
|
+
|
415
|
+
|
416
|
+
<div id="class_method_details" class="method_details_list">
|
417
|
+
<h2>Class Method Details</h2>
|
418
|
+
|
419
|
+
|
420
|
+
<div class="method_details first">
|
421
|
+
<h3 class="signature first" id="open-class_method">
|
422
|
+
|
423
|
+
+ (<tt>Object</tt>) <strong>open</strong>(filename) {|compressor| ... }
|
424
|
+
|
425
|
+
|
426
|
+
|
427
|
+
|
428
|
+
|
429
|
+
</h3><div class="docstring">
|
430
|
+
<div class="discussion">
|
431
|
+
<p>Convenience method for opening a stream, allowing content to be written
|
432
|
+
and finally closing the stream again.</p>
|
433
|
+
|
434
|
+
|
435
|
+
</div>
|
436
|
+
</div>
|
437
|
+
<div class="tags">
|
438
|
+
|
439
|
+
<p class="tag_title">Yields:</p>
|
440
|
+
<ul class="yield">
|
441
|
+
|
442
|
+
<li>
|
443
|
+
|
444
|
+
|
445
|
+
<span class='type'>(<tt>compressor</tt>)</span>
|
446
|
+
|
447
|
+
|
448
|
+
|
449
|
+
</li>
|
450
|
+
|
451
|
+
</ul>
|
452
|
+
|
453
|
+
</div><table class="source_code">
|
454
|
+
<tr>
|
455
|
+
<td>
|
456
|
+
<pre class="lines">
|
457
|
+
|
458
|
+
|
459
|
+
12
|
460
|
+
13
|
461
|
+
14
|
462
|
+
15
|
463
|
+
16</pre>
|
464
|
+
</td>
|
465
|
+
<td>
|
466
|
+
<pre class="code"><span class="info file"># File 'lib/rpub/compressor.rb', line 12</span>
|
467
|
+
|
468
|
+
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_open'>open</span><span class='lparen'>(</span><span class='id identifier rubyid_filename'>filename</span><span class='rparen'>)</span>
|
469
|
+
<span class='id identifier rubyid_compressor'>compressor</span> <span class='op'>=</span> <span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_filename'>filename</span><span class='rparen'>)</span>
|
470
|
+
<span class='kw'>yield</span> <span class='id identifier rubyid_compressor'>compressor</span>
|
471
|
+
<span class='id identifier rubyid_compressor'>compressor</span><span class='period'>.</span><span class='id identifier rubyid_close'>close</span>
|
472
|
+
<span class='kw'>end</span></pre>
|
473
|
+
</td>
|
474
|
+
</tr>
|
475
|
+
</table>
|
476
|
+
</div>
|
477
|
+
|
478
|
+
</div>
|
479
|
+
|
480
|
+
<div id="instance_method_details" class="method_details_list">
|
481
|
+
<h2>Instance Method Details</h2>
|
482
|
+
|
483
|
+
|
484
|
+
<div class="method_details first">
|
485
|
+
<h3 class="signature first" id="close-instance_method">
|
486
|
+
|
487
|
+
- (<tt>Object</tt>) <strong>close</strong>
|
488
|
+
|
489
|
+
|
490
|
+
|
491
|
+
|
492
|
+
|
493
|
+
</h3><div class="docstring">
|
494
|
+
<div class="discussion">
|
495
|
+
<p>Close the zip stream and write the file to disk.</p>
|
496
|
+
|
497
|
+
|
498
|
+
</div>
|
499
|
+
</div>
|
500
|
+
<div class="tags">
|
501
|
+
|
502
|
+
|
503
|
+
</div><table class="source_code">
|
504
|
+
<tr>
|
505
|
+
<td>
|
506
|
+
<pre class="lines">
|
507
|
+
|
508
|
+
|
509
|
+
24
|
510
|
+
25
|
511
|
+
26</pre>
|
512
|
+
</td>
|
513
|
+
<td>
|
514
|
+
<pre class="code"><span class="info file"># File 'lib/rpub/compressor.rb', line 24</span>
|
515
|
+
|
516
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_close'>close</span>
|
517
|
+
<span class='id identifier rubyid_zip'>zip</span><span class='period'>.</span><span class='id identifier rubyid_close'>close</span>
|
518
|
+
<span class='kw'>end</span></pre>
|
519
|
+
</td>
|
520
|
+
</tr>
|
521
|
+
</table>
|
522
|
+
</div>
|
523
|
+
|
524
|
+
<div class="method_details ">
|
525
|
+
<h3 class="signature " id="compress_file-instance_method">
|
526
|
+
|
527
|
+
- (<tt>Object</tt>) <strong>compress_file</strong>(filename, content)
|
528
|
+
|
529
|
+
|
530
|
+
|
531
|
+
|
532
|
+
|
533
|
+
</h3><div class="docstring">
|
534
|
+
<div class="discussion">
|
535
|
+
<p>Store a file with maximum compression in the archive.</p>
|
536
|
+
|
537
|
+
|
538
|
+
</div>
|
539
|
+
</div>
|
540
|
+
<div class="tags">
|
541
|
+
<p class="tag_title">Parameters:</p>
|
542
|
+
<ul class="param">
|
543
|
+
|
544
|
+
<li>
|
545
|
+
|
546
|
+
<span class='name'>filename</span>
|
547
|
+
|
548
|
+
|
549
|
+
<span class='type'>(<tt>String</tt>)</span>
|
550
|
+
|
551
|
+
|
552
|
+
|
553
|
+
—
|
554
|
+
<div class='inline'><p>under the which the data should be stored</p>
|
555
|
+
</div>
|
556
|
+
|
557
|
+
</li>
|
558
|
+
|
559
|
+
<li>
|
560
|
+
|
561
|
+
<span class='name'>content</span>
|
562
|
+
|
563
|
+
|
564
|
+
<span class='type'>(<tt>#to_s</tt>)</span>
|
565
|
+
|
566
|
+
|
567
|
+
|
568
|
+
—
|
569
|
+
<div class='inline'><p>to be compressed</p>
|
570
|
+
</div>
|
571
|
+
|
572
|
+
</li>
|
573
|
+
|
574
|
+
</ul>
|
575
|
+
|
576
|
+
|
577
|
+
</div><table class="source_code">
|
578
|
+
<tr>
|
579
|
+
<td>
|
580
|
+
<pre class="lines">
|
581
|
+
|
582
|
+
|
583
|
+
41
|
584
|
+
42
|
585
|
+
43
|
586
|
+
44</pre>
|
587
|
+
</td>
|
588
|
+
<td>
|
589
|
+
<pre class="code"><span class="info file"># File 'lib/rpub/compressor.rb', line 41</span>
|
590
|
+
|
591
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_compress_file'>compress_file</span><span class='lparen'>(</span><span class='id identifier rubyid_filename'>filename</span><span class='comma'>,</span> <span class='id identifier rubyid_content'>content</span><span class='rparen'>)</span>
|
592
|
+
<span class='id identifier rubyid_zip'>zip</span><span class='period'>.</span><span class='id identifier rubyid_put_next_entry'>put_next_entry</span> <span class='id identifier rubyid_filename'>filename</span><span class='comma'>,</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='const'>Zip</span><span class='op'>::</span><span class='const'>Entry</span><span class='op'>::</span><span class='const'>DEFLATED</span><span class='comma'>,</span> <span class='const'>Zlib</span><span class='op'>::</span><span class='const'>BEST_COMPRESSION</span>
|
593
|
+
<span class='id identifier rubyid_zip'>zip</span><span class='period'>.</span><span class='id identifier rubyid_write'>write</span> <span class='id identifier rubyid_content'>content</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span>
|
594
|
+
<span class='kw'>end</span></pre>
|
595
|
+
</td>
|
596
|
+
</tr>
|
597
|
+
</table>
|
598
|
+
</div>
|
599
|
+
|
600
|
+
<div class="method_details ">
|
601
|
+
<h3 class="signature " id="store_file-instance_method">
|
602
|
+
|
603
|
+
- (<tt>Object</tt>) <strong>store_file</strong>(filename, content)
|
604
|
+
|
605
|
+
|
606
|
+
|
607
|
+
|
608
|
+
|
609
|
+
</h3><div class="docstring">
|
610
|
+
<div class="discussion">
|
611
|
+
<p>Store a file in the archive without any compression.</p>
|
612
|
+
|
613
|
+
|
614
|
+
</div>
|
615
|
+
</div>
|
616
|
+
<div class="tags">
|
617
|
+
<p class="tag_title">Parameters:</p>
|
618
|
+
<ul class="param">
|
619
|
+
|
620
|
+
<li>
|
621
|
+
|
622
|
+
<span class='name'>filename</span>
|
623
|
+
|
624
|
+
|
625
|
+
<span class='type'>(<tt>String</tt>)</span>
|
626
|
+
|
627
|
+
|
628
|
+
|
629
|
+
—
|
630
|
+
<div class='inline'><p>under the which the data should be stored</p>
|
631
|
+
</div>
|
632
|
+
|
633
|
+
</li>
|
634
|
+
|
635
|
+
<li>
|
636
|
+
|
637
|
+
<span class='name'>content</span>
|
638
|
+
|
639
|
+
|
640
|
+
<span class='type'>(<tt>#to_s</tt>)</span>
|
641
|
+
|
642
|
+
|
643
|
+
|
644
|
+
—
|
645
|
+
<div class='inline'><p>to be compressed</p>
|
646
|
+
</div>
|
647
|
+
|
648
|
+
</li>
|
649
|
+
|
650
|
+
</ul>
|
651
|
+
|
652
|
+
|
653
|
+
</div><table class="source_code">
|
654
|
+
<tr>
|
655
|
+
<td>
|
656
|
+
<pre class="lines">
|
657
|
+
|
658
|
+
|
659
|
+
32
|
660
|
+
33
|
661
|
+
34
|
662
|
+
35</pre>
|
663
|
+
</td>
|
664
|
+
<td>
|
665
|
+
<pre class="code"><span class="info file"># File 'lib/rpub/compressor.rb', line 32</span>
|
666
|
+
|
667
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_store_file'>store_file</span><span class='lparen'>(</span><span class='id identifier rubyid_filename'>filename</span><span class='comma'>,</span> <span class='id identifier rubyid_content'>content</span><span class='rparen'>)</span>
|
668
|
+
<span class='id identifier rubyid_zip'>zip</span><span class='period'>.</span><span class='id identifier rubyid_put_next_entry'>put_next_entry</span> <span class='id identifier rubyid_filename'>filename</span><span class='comma'>,</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='const'>Zip</span><span class='op'>::</span><span class='const'>Entry</span><span class='op'>::</span><span class='const'>STORED</span><span class='comma'>,</span> <span class='const'>Zlib</span><span class='op'>::</span><span class='const'>NO_COMPRESSION</span>
|
669
|
+
<span class='id identifier rubyid_zip'>zip</span><span class='period'>.</span><span class='id identifier rubyid_write'>write</span> <span class='id identifier rubyid_content'>content</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span>
|
670
|
+
<span class='kw'>end</span></pre>
|
671
|
+
</td>
|
672
|
+
</tr>
|
673
|
+
</table>
|
674
|
+
</div>
|
675
|
+
|
676
|
+
</div>
|
677
|
+
|
678
|
+
</div>
|
679
|
+
|
680
|
+
<div id="footer">
|
681
|
+
Generated on Thu Aug 14 19:54:32 2014 by
|
682
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
683
|
+
0.8.7.4 (ruby-2.1.2).
|
684
|
+
</div>
|
685
|
+
|
686
|
+
</body>
|
687
|
+
</html>
|