Method: ActiveSupport::Gzip.compress
- Defined in:
- activesupport/lib/active_support/gzip.rb
.compress(source, level = Zlib::DEFAULT_COMPRESSION, strategy = Zlib::DEFAULT_STRATEGY) ⇒ Object
Compresses a string using gzip.
32 33 34 35 36 37 38 |
# File 'activesupport/lib/active_support/gzip.rb', line 32 def self.compress(source, level = Zlib::DEFAULT_COMPRESSION, strategy = Zlib::DEFAULT_STRATEGY) output = Stream.new gz = Zlib::GzipWriter.new(output, level, strategy) gz.write(source) gz.close output.string end |