diff options
| author | Randy Morgan (@morgan_randy) <[email protected]> | 2013-08-29 06:42:40 -0700 |
|---|---|---|
| committer | Randy Morgan (@morgan_randy) <[email protected]> | 2013-08-29 06:42:40 -0700 |
| commit | 3cd67db5abe6ee41309bad16793f3e937b7ad7a8 (patch) | |
| tree | f48801540ca115a88cb49b6386655cdc48638039 /lib | |
| parent | e51884a3f509d14b65223acbd899dbad32a7be61 (diff) | |
| parent | a347f42b61fca091327140e6384c432364c92d73 (diff) | |
| download | caxlsx-3cd67db5abe6ee41309bad16793f3e937b7ad7a8.tar.gz caxlsx-3cd67db5abe6ee41309bad16793f3e937b7ad7a8.zip | |
Merge pull request #231 from delwyn/rubyzip
upgrade to rubyzip 1.0.0
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/axlsx.rb | 4 | ||||
| -rw-r--r-- | lib/axlsx/package.rb | 20 |
2 files changed, 12 insertions, 12 deletions
diff --git a/lib/axlsx.rb b/lib/axlsx.rb index ffebc7ac..cb4ce635 100644 --- a/lib/axlsx.rb +++ b/lib/axlsx.rb @@ -23,7 +23,7 @@ require 'axlsx/workbook/workbook.rb' require 'axlsx/package.rb' #required gems require 'nokogiri' -require 'zip/zip' +require 'zip' #core dependencies require 'bigdecimal' @@ -136,7 +136,7 @@ module Axlsx end - # Instructs the serializer to not try to escape cell value input. + # Instructs the serializer to not try to escape cell value input. # This will give you a huge speed bonus, but if you content has <, > or other xml character data # the workbook will be invalid and excel will complain. def self.trust_input diff --git a/lib/axlsx/package.rb b/lib/axlsx/package.rb index 0a1bceaa..6cc72a09 100644 --- a/lib/axlsx/package.rb +++ b/lib/axlsx/package.rb @@ -70,7 +70,7 @@ module Axlsx #def self.parse(input, confirm_valid = false) # p = Package.new - # z = Zip::ZipFile.open(input) + # z = Zip::File.open(input) # p.workbook = Workbook.parse z.get_entry(WORKBOOK_PN) # p #end @@ -101,7 +101,7 @@ module Axlsx def serialize(output, confirm_valid=false) return false unless !confirm_valid || self.validate.empty? Relationship.clear_cached_instances - Zip::ZipOutputStream.open(output) do |zip| + Zip::OutputStream.open(output) do |zip| write_parts(zip) end true @@ -114,7 +114,7 @@ module Axlsx def to_stream(confirm_valid=false) return false unless !confirm_valid || self.validate.empty? Relationship.clear_cached_instances - zip = write_parts(Zip::ZipOutputStream.new("streamed", true)) + zip = write_parts(Zip::OutputStream.new("streamed", true)) stream = zip.close_buffer stream.rewind stream @@ -154,8 +154,8 @@ module Axlsx private # Writes the package parts to a zip archive. - # @param [Zip::ZipOutputStream] zip - # @return [Zip::ZipOutputStream] + # @param [Zip::OutputStream] zip + # @return [Zip::OutputStream] def write_parts(zip) p = parts p.each do |part| @@ -173,8 +173,8 @@ module Axlsx zip end - # Generate a ZipEntry for the given package part. - # The important part here is to explicitly set the timestamp for the zip entry: Serializing axlsx packages + # Generate a Entry for the given package part. + # The important part here is to explicitly set the timestamp for the zip entry: Serializing axlsx packages # with identical contents should result in identical zip files – however, the timestamp of a zip entry # defaults to the time of serialization and therefore the zip file contents would be different every time # the package is serialized. @@ -183,12 +183,12 @@ module Axlsx # to set this explicitly, too (eg. with `Package.new(created_at: Time.local(2013, 1, 1))`). # # @param part A hash describing a part of this pacakge (see {#parts}) - # @return [Zip::ZipEntry] + # @return [Zip::Entry] def zip_entry_for_part(part) timestamp = Zip::DOSTime.at(@core.created.to_i) - Zip::ZipEntry.new("", part[:entry], "", "", 0, 0, Zip::ZipEntry::DEFLATED, 0, timestamp) + Zip::Entry.new("", part[:entry], "", "", 0, 0, Zip::Entry::DEFLATED, 0, timestamp) end - + # The parts of a package # @return [Array] An array of hashes that define the entry, document and schema for each part of the package. # @private |
