summaryrefslogtreecommitdiff
path: root/Zip
diff options
context:
space:
mode:
authorPaul Duncan <pabs@pablotron.org>2016-08-10 21:16:44 -0400
committerPaul Duncan <pabs@pablotron.org>2016-08-10 21:16:44 -0400
commit055abed0e28681387377671bc16d40d075e3aaf7 (patch)
treefb038fde87156a164ba7ce64f80dffa0494286f7 /Zip
parent25199ab4c29057d7c0a73812fc8f2ac3605c1d86 (diff)
downloadzip-crystal-055abed0e28681387377671bc16d40d075e3aaf7.tar.bz2
zip-crystal-055abed0e28681387377671bc16d40d075e3aaf7.zip
update documentation
Diffstat (limited to 'Zip')
-rw-r--r--Zip/Archive.html32
-rw-r--r--Zip/Entry.html53
-rw-r--r--Zip/Error.html3
-rw-r--r--Zip/Extra.html10
-rw-r--r--Zip/Writer.html49
5 files changed, 74 insertions, 73 deletions
diff --git a/Zip/Archive.html b/Zip/Archive.html
index ea6e914..332b0f1 100644
--- a/Zip/Archive.html
+++ b/Zip/Archive.html
@@ -298,9 +298,9 @@
<p>Example:</p>
-<p># get bar.txt and read it into memory io
-io = MemoryIO.new
-zip["bar.txt"].read(io)</p></div>
+<pre><code><span class="c"># get bar.txt and read it into memory io</span>
+io <span class="o">=</span> <span class="t">MemoryIO</span>.<span class="k">new</span>
+zip[<span class="s">&quot;bar.txt&quot;</span>].read(io)</code></pre></div>
<br/>
<div>
@@ -320,9 +320,9 @@ zip["bar.txt"].read(io)</p></div>
<p>Example:</p>
-<p># read third entry from archive into memory io
-io = MemoryIO.new
-zip[2].read(io)</p></div>
+<pre><code><span class="c"># read third entry from archive into memory io</span>
+io <span class="o">=</span> <span class="t">MemoryIO</span>.<span class="k">new</span>
+zip[<span class="n">2</span>].read(io)</code></pre></div>
<br/>
<div>
@@ -342,11 +342,11 @@ zip[2].read(io)</p></div>
<p>Example:</p>
-<p># read third entry from archive into memory io
-if e = zip[2]
-io = MemoryIO.new
-e.read(io)
-end</p></div>
+<pre><code><span class="c"># read third entry from archive into memory io</span>
+<span class="k">if</span> e <span class="o">=</span> zip[<span class="n">2</span>]?
+ io <span class="o">=</span> <span class="t">MemoryIO</span>.<span class="k">new</span>
+ e.read(io)
+<span class="k">end</span></code></pre></div>
<br/>
<div>
@@ -366,11 +366,11 @@ end</p></div>
<p>Example:</p>
-<p># read bar.txt into memory io if it exists
-if e = zip["bar.txt"]?
-io = MemoryIO.new
-e.read(io)
-end</p></div>
+<pre><code><span class="c"># read bar.txt into memory io if it exists</span>
+<span class="k">if</span> e <span class="o">=</span> zip[<span class="s">&quot;bar.txt&quot;</span>]?
+ io <span class="o">=</span> <span class="t">MemoryIO</span>.<span class="k">new</span>
+ e.read(io)
+<span class="k">end</span></code></pre></div>
<br/>
<div>
diff --git a/Zip/Entry.html b/Zip/Entry.html
index 6626777..9e31614 100644
--- a/Zip/Entry.html
+++ b/Zip/Entry.html
@@ -121,18 +121,17 @@ specific archive entry.</p>
<p>Example:</p>
-<p># create MemoryIO
-io = MemoryIO.new</p>
+<pre><code><span class="c"># create MemoryIO</span>
+io <span class="o">=</span> <span class="t">MemoryIO</span>.<span class="k">new</span>
-<p># open "foo.zip"
-Zip.read("foo.zip") do |zip|
-# get "bar.txt" entry from "foo.zip"
-e = zip["bar.txt"]</p>
+<span class="c"># open &quot;foo.zip&quot;</span>
+<span class="t">Zip</span>.read(<span class="s">&quot;foo.zip&quot;</span>) <span class="k">do</span> <span class="o">|</span>zip<span class="o">|</span>
+ <span class="c"># get &quot;bar.txt&quot; entry from &quot;foo.zip&quot;</span>
+ e <span class="o">=</span> zip[<span class="s">&quot;bar.txt&quot;</span>]
-<pre><code><span class="c"># read contents of &quot;bar.txt&quot; into io</span>
-e.read(io)</code></pre>
-
-<p>end</p>
+ <span class="c"># read contents of &quot;bar.txt&quot; into io</span>
+ e.read(io)
+<span class="k">end</span></code></pre>
@@ -463,11 +462,11 @@ file's entry in the Central Directory, and this method returns the
<p>Example:</p>
-<p># open "./foo.zip"
-Zip.read("./foo.zip") do |zip|
-# get array of local extra attributes from "bar.txt"
-extras = zip["bar.txt"].local_extras
-end</p></div>
+<pre><code><span class="c"># open &quot;./foo.zip&quot;</span>
+<span class="t">Zip</span>.read(<span class="s">&quot;./foo.zip&quot;</span>) <span class="k">do</span> <span class="o">|</span>zip<span class="o">|</span>
+ <span class="c"># get array of local extra attributes from &quot;bar.txt&quot;</span>
+ extras <span class="o">=</span> zip[<span class="s">&quot;bar.txt&quot;</span>].local_extras
+<span class="k">end</span></code></pre></div>
<br/>
<div>
@@ -532,14 +531,14 @@ compression method is unsupported.</p>
<p>Example:</p>
-<p># open "output-bar.txt" for writing
-File.open("output-bar.txt", "wb") do |io|
-# open archive "./foo.zip"
-Zip.read("foo.zip") do |zip|
-# write contents of "bar.txt" to "output-bar.txt"
-zip["foo.txt"].read(io)
-end
-end</p></div>
+<pre><code><span class="c"># open &quot;output-bar.txt&quot; for writing</span>
+<span class="t">File</span>.open(<span class="s">&quot;output-bar.txt&quot;</span>, <span class="s">&quot;wb&quot;</span>) <span class="k">do</span> <span class="o">|</span>io<span class="o">|</span>
+ <span class="c"># open archive &quot;./foo.zip&quot;</span>
+ <span class="t">Zip</span>.read(<span class="s">&quot;foo.zip&quot;</span>) <span class="k">do</span> <span class="o">|</span>zip<span class="o">|</span>
+ <span class="c"># write contents of &quot;bar.txt&quot; to &quot;output-bar.txt&quot;</span>
+ zip[<span class="s">&quot;foo.txt&quot;</span>].read(io)
+ <span class="k">end</span>
+<span class="k">end</span></code></pre></div>
<br/>
<div>
@@ -559,10 +558,10 @@ end</p></div>
<p>Example:</p>
-<p>Zip.read("foo.zip") do |zip|
-size = zip["bar.txt"].size
-puts "bar.txt is #{size} bytes."
-end</p></div>
+<pre><code><span class="t">Zip</span>.read(<span class="s">&quot;foo.zip&quot;</span>) <span class="k">do</span> <span class="o">|</span>zip<span class="o">|</span>
+ size <span class="o">=</span> zip[<span class="s">&quot;bar.txt&quot;</span>].size
+ puts <span class="s">&quot;bar.txt is </span><span class="i">#{</span></span>size<span class="s"><span class="i">}</span> bytes.&quot;</span>
+<span class="k">end</span></code></pre></div>
<br/>
<div>
diff --git a/Zip/Error.html b/Zip/Error.html
index fc71ef7..d2a611e 100644
--- a/Zip/Error.html
+++ b/Zip/Error.html
@@ -116,6 +116,9 @@
<p>Wrapper class for exceptions.</p>
+<p>You shouldn't need to instantiate this class directly; it is raised
+by other classes on error.</p>
+
diff --git a/Zip/Extra.html b/Zip/Extra.html
index cb489df..3ea15f3 100644
--- a/Zip/Extra.html
+++ b/Zip/Extra.html
@@ -121,11 +121,11 @@
<p>Example:</p>
-<p># open "foo.zip"
-Zip.read("foo.zip") do |zip|
-# get extra data associated with "bar.txt"
-extras = zip["bar.txt"].extras
-end</p>
+<pre><code><span class="c"># open &quot;foo.zip&quot;</span>
+<span class="t">Zip</span>.read(<span class="s">&quot;foo.zip&quot;</span>) <span class="k">do</span> <span class="o">|</span>zip<span class="o">|</span>
+ <span class="c"># get extra data associated with &quot;bar.txt&quot;</span>
+ extras <span class="o">=</span> zip[<span class="s">&quot;bar.txt&quot;</span>].extras
+<span class="k">end</span></code></pre>
diff --git a/Zip/Writer.html b/Zip/Writer.html
index c28c13e..894055d 100644
--- a/Zip/Writer.html
+++ b/Zip/Writer.html
@@ -255,14 +255,14 @@ return the number of bytes written.</p>
<p>Example:</p>
-<p># create IO from "/path/to/bar.txt"
-File.open("/path/to/bar.txt, "rb") do |io|
-# write to "foo.zip"
-Zip.write("foo.zip") do |zip|
-# add "bar.txt" with contents of given IO
-zip.add("bar.txt", io)
-end
-end</p></div>
+<pre><code><span class="c"># create IO from &quot;/path/to/bar.txt&quot;</span>
+<span class="t">File</span>.open(<span class="s">&quot;/path/to/bar.txt, &quot;</span>rb<span class="s">&quot;&#41; do |io|
+ # write to &quot;</span>foo.zip<span class="s">&quot;
+ Zip.write&#40;&quot;</span>foo.zip<span class="s">&quot;&#41; do |zip|
+ # add &quot;</span>bar.txt<span class="s">&quot; with contents of given IO
+ zip.add&#40;&quot;</span>bar.txt<span class="s">&quot;, io&#41;
+ end
+end</code></pre></div>
<br/>
<div>
@@ -283,11 +283,11 @@ written.</p>
<p>Example:</p>
-<p># write to "foo.zip"
-Zip.write("foo.zip") do |zip|
-# add "bar.txt" with contents "hello!"
-zip.add("bar.txt", "hello!")
-end</p></div>
+<pre><code><span class="c"># write to &quot;foo.zip&quot;</span>
+<span class="t">Zip</span>.write(<span class="s">&quot;foo.zip&quot;</span>) <span class="k">do</span> <span class="o">|</span>zip<span class="o">|</span>
+ <span class="c"># add &quot;bar.txt&quot; with contents &quot;hello&#33;&quot;</span>
+ zip.add(<span class="s">&quot;bar.txt&quot;</span>, <span class="s">&quot;hello&#33;&quot;</span>)
+<span class="k">end</span></code></pre></div>
<br/>
<div>
@@ -308,11 +308,11 @@ of bytes written.</p>
<p>Example:</p>
-<p># write to "foo.zip"
-Zip.write("foo.zip") do |zip|
-# add local file "/path/to/bar.txt" as "bar.txt"
-zip.add_file("bar.txt", "/path/to/bar.txt")
-end</p></div>
+<pre><code><span class="c"># write to &quot;foo.zip&quot;</span>
+<span class="t">Zip</span>.write(<span class="s">&quot;foo.zip&quot;</span>) <span class="k">do</span> <span class="o">|</span>zip<span class="o">|</span>
+ <span class="c"># add local file &quot;/path/to/bar.txt&quot; as &quot;bar.txt&quot;</span>
+ zip.add_file(<span class="s">&quot;bar.txt&quot;</span>, <span class="s">&quot;/path/to/bar.txt&quot;</span>)
+<span class="k">end</span></code></pre></div>
<br/>
<div>
@@ -332,14 +332,13 @@ end</p></div>
<p>Example:</p>
-<p>Zip.write("foo.zip") do |zip|
-# add "bar.txt"
-zip.add_file("bar.txt", "/path/to/bar.txt")</p>
+<pre><code><span class="t">Zip</span>.write(<span class="s">&quot;foo.zip&quot;</span>) <span class="k">do</span> <span class="o">|</span>zip<span class="o">|</span>
+ <span class="c"># add &quot;bar.txt&quot;</span>
+ zip.add_file(<span class="s">&quot;bar.txt&quot;</span>, <span class="s">&quot;/path/to/bar.txt&quot;</span>)
-<pre><code><span class="c"># print number of bytes written so far</span>
-puts <span class="s">&quot;bytes written so far: </span><span class="i">#{</span></span>zip.bytes_written<span class="s"><span class="i">}</span>&quot;</span></code></pre>
-
-<p>end</p></div>
+ <span class="c"># print number of bytes written so far</span>
+ puts <span class="s">&quot;bytes written so far: </span><span class="i">#{</span></span>zip.bytes_written<span class="s"><span class="i">}</span>&quot;</span>
+<span class="k">end</span></code></pre></div>
<br/>
<div>