Class: WebAssets::Gzipper
- Inherits:
-
Object
- Object
- WebAssets::Gzipper
- Defined in:
- lib/web_assets/gzipper.rb
Class Method Summary collapse
Class Method Details
.compress(content) ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/web_assets/gzipper.rb', line 5 def self.compress content stream = StringIO.new gz = Zlib::GzipWriter.new stream, Zlib::BEST_COMPRESSION gz.write content gz.close stream.string end |
.uncompress(zipped) ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/web_assets/gzipper.rb', line 13 def self.uncompress zipped stream = StringIO.new zipped gz = Zlib::GzipReader.new stream content = gz.read gz.close content end |