Handle passing an IO to Zip::File.new better.
This now actually extracts the path from the IO if one is passed in.
This commit is contained in:
parent
7cd263e6a0
commit
cfa9441914
|
@ -64,9 +64,9 @@ module Zip
|
||||||
|
|
||||||
# Opens a zip archive. Pass true as the second parameter to create
|
# Opens a zip archive. Pass true as the second parameter to create
|
||||||
# a new archive if it doesn't exist already.
|
# a new archive if it doesn't exist already.
|
||||||
def initialize(file_name, create = false, buffer = false, options = {})
|
def initialize(path_or_io, create = false, buffer = false, options = {})
|
||||||
super()
|
super()
|
||||||
@name = file_name
|
@name = path_or_io.respond_to?(:path) ? path_or_io.path : path_or_io
|
||||||
@comment = ''
|
@comment = ''
|
||||||
@create = create ? true : false # allow any truthy value to mean true
|
@create = create ? true : false # allow any truthy value to mean true
|
||||||
if !buffer && ::File.size?(@name)
|
if !buffer && ::File.size?(@name)
|
||||||
|
|
Loading…
Reference in New Issue