KenB
KenB

Reputation: 6757

rubyzip Zip::FileSystem::ZipFsDir glob method broken?

Using version 1.2.0, I am getting strange results when I try to call glob on a ZipFsDir object. In a rails console:

> require 'zip/filesystem'
 => true 
> file = '/home/me/test.zip'
 => "/home/me/test.zip" 
> zf = Zip::File.open file
 => #<Zip::File:0x0000000880e0c8...
> d = zf.dir
 => #<Zip::FileSystem::ZipFsDir:0x0000000880e028
> d.class
 => Zip::FileSystem::ZipFsDir
> d.glob("*.shp")
NoMethodError: undefined method `glob' for #<Zip::FileSystem::ZipFileNameMapper:0x0000000880e078>

Why is it reporting that the method is undefined for Zip::FileSystem::ZipFileNameMapper? I called it on a ZipFsDir object. The docs clearly list glob as a ZipFsDir instance method.

Upvotes: 0

Views: 127

Answers (1)

Nic Nilov
Nic Nilov

Reputation: 5156

One reason this is happening is ZipFileNameMapper indeed does not implement the glob method as can be seen in it's source.

According to this statement:

All access to Zip::File from ZipFsFile and ZipFsDir goes through a ZipFileNameMapper

ZipFileNameMapper should implement glob which it doesn't so it looks like a possible bug.

Upvotes: 1

Related Questions