From 055abed0e28681387377671bc16d40d075e3aaf7 Mon Sep 17 00:00:00 2001 From: Paul Duncan Date: Wed, 10 Aug 2016 21:16:44 -0400 Subject: update documentation --- Zip.html | 86 ++++++++++++++++++++++++++++++++-------------------------------- 1 file changed, 43 insertions(+), 43 deletions(-) (limited to 'Zip.html') diff --git a/Zip.html b/Zip.html index fb7cad4..b28c867 100644 --- a/Zip.html +++ b/Zip.html @@ -118,22 +118,22 @@

Reading from a zip file:

-

# create output MemoryIO -mem_io = MemoryIO.new

+
# create output MemoryIO
+mem_io = MemoryIO.new
 
-

# read from "foo.zip" -Zip.read("foo.zip") do |zip| -# read contents of "bar.txt" in "foo.zip" into mem_io -zip["bar.txt"].read(mem_io) -end

+# read from "foo.zip" +Zip.read("foo.zip") do |zip| + # read contents of "bar.txt" in "foo.zip" into mem_io + zip["bar.txt"].read(mem_io) +end

Writing to a zip file:

-

# write to "foo.zip" -Zip.write("foo.zip") do |zip| -# create "bar.txt" with contents "hello!" -zip.add("bar.txt", "hello!") -end

+
# write to "foo.zip"
+Zip.write("foo.zip") do |zip|
+  # create "bar.txt" with contents "hello!"
+  zip.add("bar.txt", "hello!")
+end
@@ -254,14 +254,14 @@ end

Example:

-

# create memory io for contents of "bar.txt" -io = MemoryIO.new

+
# create memory io for contents of "bar.txt"
+io = MemoryIO.new
 
-

# extract "bar.txt" from zip archive in Slice some_slice and -# save it to MemoryIO -Zip.read(some_slice) do |zip| -zip["bar.txt"].read(io) -end

+# extract "bar.txt" from zip archive in Slice some_slice and +# save it to MemoryIO +Zip.read(some_slice) do |zip| + zip["bar.txt"].read(io) +end

@@ -281,13 +281,13 @@ end

Example:

-

# create memory io for contents of "bar.txt" -io = MemoryIO.new

+
# create memory io for contents of "bar.txt"
+io = MemoryIO.new
 
-

# extract "bar.txt" from "./foo.zip" and save it to MemoryIO -Zip.read("./foo.zip") do |zip| -zip["bar.txt"].read(io) -end

+# extract "bar.txt" from "foo.zip" and save it to MemoryIO +Zip.read("foo.zip") do |zip| + zip["bar.txt"].read(io) +end

@@ -308,13 +308,13 @@ block.

Example:

-

# create memory io for contents of "bar.txt" -io = MemoryIO.new

+
# create memory io for contents of "bar.txt"
+io = MemoryIO.new
 
-

# read "bar.txt" from "./foo.zip" -Zip.read(File.open("./foo.zip", "rb")) do |zip| -zip["bar.txt"].read(io) -end

+# read "bar.txt" from "foo.zip" +Zip.read(File.open("foo.zip", "rb")) do |zip| + zip["bar.txt"].read(io) +end
@@ -335,13 +335,13 @@ the given block. Returns number of bytes written.

Example:

-

# create output IO -File.open("foo.zip", "wb") do |io| -Zip.write(io) do |zip| -# add "bar.txt" with contents "hello!" -zip.add("bar.txt", "hello!") -end -end

+
# create output IO
+File.open("foo.zip", "wb") do |io|
+  Zip.write(io) do |zip|
+    # add "bar.txt" with contents "hello!"
+    zip.add("bar.txt", "hello!")
+  end
+end

@@ -362,11 +362,11 @@ the given block. Returns number of bytes written.

Example:

-

# create "foo.zip" -Zip.write("foo.zip") do |zip| -# add "bar.txt" with contents "hello!" -zip.add("bar.txt", "hello!") -end

+
# create "foo.zip"
+Zip.write("foo.zip") do |zip|
+  # add "bar.txt" with contents "hello!"
+  zip.add("bar.txt", "hello!")
+end

-- cgit v1.2.3