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 ++++++++++++++++++++++++++++---------------------------- Zip/Archive.html | 32 ++++++++++----------- Zip/Entry.html | 53 +++++++++++++++++----------------- Zip/Error.html | 3 ++ Zip/Extra.html | 10 +++---- Zip/Writer.html | 49 ++++++++++++++++---------------- 6 files changed, 117 insertions(+), 116 deletions(-) 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

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 @@

Example:

-

# get bar.txt and read it into memory io -io = MemoryIO.new -zip["bar.txt"].read(io)

+
# get bar.txt and read it into memory io
+io = MemoryIO.new
+zip["bar.txt"].read(io)

@@ -320,9 +320,9 @@ zip["bar.txt"].read(io)

Example:

-

# read third entry from archive into memory io -io = MemoryIO.new -zip[2].read(io)

+
# read third entry from archive into memory io
+io = MemoryIO.new
+zip[2].read(io)

@@ -342,11 +342,11 @@ zip[2].read(io)

Example:

-

# read third entry from archive into memory io -if e = zip[2] -io = MemoryIO.new -e.read(io) -end

+
# read third entry from archive into memory io
+if e = zip[2]?
+  io = MemoryIO.new
+  e.read(io)
+end

@@ -366,11 +366,11 @@ end

Example:

-

# read bar.txt into memory io if it exists -if e = zip["bar.txt"]? -io = MemoryIO.new -e.read(io) -end

+
# read bar.txt into memory io if it exists
+if e = zip["bar.txt"]?
+  io = MemoryIO.new
+  e.read(io)
+end

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.

Example:

-

# create MemoryIO -io = MemoryIO.new

+
# create MemoryIO
+io = MemoryIO.new
 
-

# open "foo.zip" -Zip.read("foo.zip") do |zip| -# get "bar.txt" entry from "foo.zip" -e = zip["bar.txt"]

+# open "foo.zip" +Zip.read("foo.zip") do |zip| + # get "bar.txt" entry from "foo.zip" + e = zip["bar.txt"] -
# read contents of "bar.txt" into io
-e.read(io)
- -

end

+ # read contents of "bar.txt" into io + e.read(io) +end
@@ -463,11 +462,11 @@ file's entry in the Central Directory, and this method returns the

Example:

-

# 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

+
# 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

@@ -532,14 +531,14 @@ compression method is unsupported.

Example:

-

# 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

+
# 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

@@ -559,10 +558,10 @@ end

Example:

-

Zip.read("foo.zip") do |zip| -size = zip["bar.txt"].size -puts "bar.txt is #{size} bytes." -end

+
Zip.read("foo.zip") do |zip|
+  size = zip["bar.txt"].size
+  puts "bar.txt is #{size} bytes."
+end

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 @@

Wrapper class for exceptions.

+

You shouldn't need to instantiate this class directly; it is raised +by other classes on error.

+ 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 @@

Example:

-

# open "foo.zip" -Zip.read("foo.zip") do |zip| -# get extra data associated with "bar.txt" -extras = zip["bar.txt"].extras -end

+
# open "foo.zip"
+Zip.read("foo.zip") do |zip|
+  # get extra data associated with "bar.txt"
+  extras = zip["bar.txt"].extras
+end
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.

Example:

-

# 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

+
# 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

@@ -283,11 +283,11 @@ written.

Example:

-

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

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

@@ -308,11 +308,11 @@ of bytes written.

Example:

-

# 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

+
# 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

@@ -332,14 +332,13 @@ end

Example:

-

Zip.write("foo.zip") do |zip| -# add "bar.txt" -zip.add_file("bar.txt", "/path/to/bar.txt")

+
Zip.write("foo.zip") do |zip|
+  # add "bar.txt"
+  zip.add_file("bar.txt", "/path/to/bar.txt")
 
-
# print number of bytes written so far
-puts "bytes written so far: #{zip.bytes_written}"
- -

end

+ # print number of bytes written so far + puts "bytes written so far: #{zip.bytes_written}" +end

-- cgit v1.2.3