diff options
author | Paul Duncan <pabs@pablotron.org> | 2016-08-10 21:16:44 -0400 |
---|---|---|
committer | Paul Duncan <pabs@pablotron.org> | 2016-08-10 21:16:44 -0400 |
commit | 055abed0e28681387377671bc16d40d075e3aaf7 (patch) | |
tree | fb038fde87156a164ba7ce64f80dffa0494286f7 /Zip/Writer.html | |
parent | 25199ab4c29057d7c0a73812fc8f2ac3605c1d86 (diff) | |
download | zip-crystal-055abed0e28681387377671bc16d40d075e3aaf7.tar.bz2 zip-crystal-055abed0e28681387377671bc16d40d075e3aaf7.zip |
update documentation
Diffstat (limited to 'Zip/Writer.html')
-rw-r--r-- | Zip/Writer.html | 49 |
1 files changed, 24 insertions, 25 deletions
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 "/path/to/bar.txt"</span> +<span class="t">File</span>.open(<span class="s">"/path/to/bar.txt, "</span>rb<span class="s">") do |io| + # write to "</span>foo.zip<span class="s">" + Zip.write("</span>foo.zip<span class="s">") do |zip| + # add "</span>bar.txt<span class="s">" with contents of given IO + zip.add("</span>bar.txt<span class="s">", io) + 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 "foo.zip"</span> +<span class="t">Zip</span>.write(<span class="s">"foo.zip"</span>) <span class="k">do</span> <span class="o">|</span>zip<span class="o">|</span> + <span class="c"># add "bar.txt" with contents "hello!"</span> + zip.add(<span class="s">"bar.txt"</span>, <span class="s">"hello!"</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 "foo.zip"</span> +<span class="t">Zip</span>.write(<span class="s">"foo.zip"</span>) <span class="k">do</span> <span class="o">|</span>zip<span class="o">|</span> + <span class="c"># add local file "/path/to/bar.txt" as "bar.txt"</span> + zip.add_file(<span class="s">"bar.txt"</span>, <span class="s">"/path/to/bar.txt"</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">"foo.zip"</span>) <span class="k">do</span> <span class="o">|</span>zip<span class="o">|</span> + <span class="c"># add "bar.txt"</span> + zip.add_file(<span class="s">"bar.txt"</span>, <span class="s">"/path/to/bar.txt"</span>) -<pre><code><span class="c"># print number of bytes written so far</span> -puts <span class="s">"bytes written so far: </span><span class="i">#{</span></span>zip.bytes_written<span class="s"><span class="i">}</span>"</span></code></pre> - -<p>end</p></div> + <span class="c"># print number of bytes written so far</span> + puts <span class="s">"bytes written so far: </span><span class="i">#{</span></span>zip.bytes_written<span class="s"><span class="i">}</span>"</span> +<span class="k">end</span></code></pre></div> <br/> <div> |