How to access’ zip’gem (or ‘Rubyzip’) in Ruby?

I must miss something completely obvious, but I can’t seem to get the’zip’ gem to work. I have installed it with rubygems, just like I have done many other gems. Rubygem Said it was there but when I tried to ask for it, Ruby said it was not there. I had the same problem on both Windows and Linux. This is a Linux session (extra output removed for brevity): < p>

~$ruby -v
ruby 1.8.7 (2011-02-18 patchlevel 334) [x86_64-linux]
~$gem list z
~$sudo gem install zip
Successfully installed zip-2.0.2
~$irb
irb(main):001:0> require'zip/zip'< br />LoadError: no such file to load - zip/zip
from (irb):1:in `require'
from (irb):1
from :0

Session with Windows:

C:\> ruby ​​-v
ruby 1.8.7 (2011-02-18 patchlevel 334) [i386-mingw32 ]
C:\> gem list z
C:\> gem install zip
Successfully installed zip-2.0.2
C:\> irb
irb(main ):001:0> require'zip/zip'
LoadError: no such file to load - zip/zip
from (irb):1:in `require'
from (irb ):1

I think there may be some potential dependencies required for “zip”, but I did not find any relevant information in the documentation.

I also have the same lack in’rubyzip’ Success seems maybe’zip’ and’r Is ubyzip’ a fork?

Any ideas? Or, if there is a better gem archive, I would love to hear it. The choice of zip archiving gems is confusing. The gem’Zippy’ looks good but it needs a’zip’ so I am still stuck.

try this.

gem install rubyzip2

Then

irb> require'rubygems'
#=> true
irb> require'zip/zip'< br />#=> true
# you can also require'zip/zipfilesystem'

I must miss something completely obvious, but I can’t seem to get The’zip’ gem works. I have installed it with rubygems, like I have done many other gems. Rubygem says it is there but when I try to ask for it, Ruby says it is not there. I am on Windows and Linux Both encountered the same problem. This is a Linux session (extra output removed for brevity):

~$ruby -v
ruby 1.8.7 (2011-02-18 patchlevel 334) [x86_64-linux]
~$gem list z
~$sudo gem install zip
Successfully installed zip-2.0.2
~$irb
irb(main):001:0> require'zip/zip'
LoadError: no such file to load - zip/zip
from (irb):1 :in `require'
from (irb):1
from :0

And Windows session:

C:\ > ruby ​​-v
ruby 1.8.7 (2011-02-18 pa tchlevel 334) [i386-mingw32]
C:\> gem list z
C:\> gem install zip
Successfully installed zip-2.0.2
C:\> irb
irb(main):001:0> require'zip/zip'
LoadError: no such file to load - zip/zip
from (irb):1:in `require'
from (irb):1

I think there may be some potential dependencies required for “zip”, but I did not find any relevant information in the document.

‘rubyzip’ has the same lack of success. It seems that maybe’zip’ and’rubyzip’ are forks?

Any ideas? Or, if there is a better gem archive, I would love to hear it. The choice of zip archiving gems is confusing. The gem’Zippy’ looks good but it needs a’zip’ so I am still stuck.

Try this.

gem install rubyzip2

and then

irb> require'rubygems'
#=> true
irb> require'zip/zip'
#=> true
# you can also require'zip/zipfilesystem'

Leave a Comment

Your email address will not be published.