From 055abed0e28681387377671bc16d40d075e3aaf7 Mon Sep 17 00:00:00 2001
From: Paul Duncan
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
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
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