Class: Zumobi::GzipWriter

Inherits:
Object
  • Object
show all
Defined in:
lib/zumobi/gzip_writer.rb

Class Method Summary collapse

Class Method Details

.gzip(string) ⇒ Object



6
7
8
9
10
11
12
13
# File 'lib/zumobi/gzip_writer.rb', line 6

def self.gzip(string)
  #http://devblog.famundo.com/articles/2007/03/02/serving-compressed-content-from-amazons-s3
  strio = StringIO.open('', 'w')
  gz = Zlib::GzipWriter.new(strio)
  gz.write(string)
  gz.close
  strio.string
end