DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

Patch Rubygems On Windows For ERROR: While Executing Gem ... (Zlib::BufError) While Gem Install

07.21.2009
| 4545 views |
  • submit to reddit
        
# site_ruby\ruby1.8\rubygems.rb
  def self.gunzip(data)
    require 'stringio'
    require 'zlib'
    data = StringIO.new data

    # Zlib::GzipReader.new(data).read
    data.read(10) # skip the gzip header
    zis = Zlib::Inflate.new(-Zlib::MAX_WBITS)
    is = StringIO.new(zis.inflate(data.read))
  end