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/Archive.html | 32 ++++++++++++++++---------------- Zip/Entry.html | 53 ++++++++++++++++++++++++++--------------------------- Zip/Error.html | 3 +++ Zip/Extra.html | 10 +++++----- Zip/Writer.html | 49 ++++++++++++++++++++++++------------------------- 5 files changed, 74 insertions(+), 73 deletions(-) (limited to 'Zip') 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