From d64ce278f01cafc1c3c23aec9bb2394412ad160b Mon Sep 17 00:00:00 2001 From: Paul Duncan Date: Thu, 11 Aug 2016 00:30:34 -0400 Subject: update documentation --- Zip/Archive.html | 110 ++++++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 100 insertions(+), 10 deletions(-) (limited to 'Zip/Archive.html') diff --git a/Zip/Archive.html b/Zip/Archive.html index 332b0f1..cb75fac 100644 --- a/Zip/Archive.html +++ b/Zip/Archive.html @@ -85,8 +85,28 @@ -
  • - WriterEntry +
  • + Writers + + +
  • @@ -195,31 +215,43 @@
  • #comment : String +

    Get the Archive comment as a String.

    +
  • #each(*args, **options, &block) +

    Iterate over the entries in this Archive, or, if called without a block, return a lazy iterator.

    +
  • #each(*args, **options) +

    Iterate over the entries in this Archive, or, if called without a block, return a lazy iterator.

    +
  • #entries : Array(Zip::Entry) +

    Return an array of entries in this Archive.

    +
  • #size(*args, **options, &block) +

    Return the number of entries in this Archive.

    +
  • #size(*args, **options) +

    Return the number of entries in this Archive.

    +
  • @@ -298,9 +330,9 @@

    Example:

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

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

    Example:

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

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

    Example:

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

    @@ -366,10 +398,10 @@ zip[2].read(io)

    Example:

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

    @@ -386,6 +418,15 @@ zip[2].read(io)
    # +

    Get the Archive comment as a String.

    + +

    Example:

    + +
    Zip.read("foo.zip") do |zip|
    +  # print archive comment
    +  puts "comment: #{zip.comment}"
    +end
    +
    @@ -400,6 +441,18 @@ zip[2].read(io)
    # +

    Iterate over the entries in this Archive, or, if called without +a block, return a lazy iterator.

    + +

    Example:

    + +
    Zip.read("foo.zip") do |zip|
    +  zip.each do |e|
    +    type = e.dir? ? "directory" : "file"
    +    puts "#{e.path} is a #{type}"
    +  end
    +end
    +
    @@ -414,6 +467,18 @@ zip[2].read(io)
    # +

    Iterate over the entries in this Archive, or, if called without +a block, return a lazy iterator.

    + +

    Example:

    + +
    Zip.read("foo.zip") do |zip|
    +  zip.each do |e|
    +    type = e.dir? ? "directory" : "file"
    +    puts "#{e.path} is a #{type}"
    +  end
    +end
    +
    @@ -428,6 +493,15 @@ zip[2].read(io)
    # +

    Return an array of entries in this Archive.

    + +

    Example:

    + +
    Zip.read("foo.zip") do |zip|
    +  # get an array of entries in this archive
    +  entries = zip.entries
    +end
    +
    @@ -442,6 +516,14 @@ zip[2].read(io)
    # +

    Return the number of entries in this Archive.

    + +

    Example:

    + +
    Zip.read("foo.zip") do |zip|
    +  puts "foo.zip has #{zip.size} entries"
    +end
    +
    @@ -456,6 +538,14 @@ zip[2].read(io)
    # +

    Return the number of entries in this Archive.

    + +

    Example:

    + +
    Zip.read("foo.zip") do |zip|
    +  puts "foo.zip has #{zip.size} entries"
    +end
    +
    -- cgit v1.2.3