Ruby on Rails Thursday, January 12, 2012

I had the same problem; in my case it arose from treating the file
reference returned from Zip::ZipFile.each{} as a string (like
Dir.each{}) instead of whatever it actually is. Add ".name" where you
need the file name. This code gave the error:

Zip::ZipFile.open(file) { |zip_file|
zip_file.each { |f|
myLogger("Inspecting file #{f}")
next unless f.file?
...

...and this worked:

Zip::ZipFile.open(file) { |zip_file|
zip_file.each { |f|
myLogger("Inspecting file #{f.name}")
next unless f.file?
...

Cheers,

BillR

--
Posted via http://www.ruby-forum.com/.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

No comments:

Post a Comment