### Home Classes Methods

### In Files

- lib/facets/zlib.rb

### Methods

- ::compress
- ::decompress
- ::deflate
- ::inflate

### Files

- README.rdoc

### Class/Module Index

Quicksearch

- Random
- Random::ArrayExtensions
- Random::HashExtensions
- Random::IntegerExtensions
- Random::NumericExtensions
- Random::RangeExtensions
- Random::StringExtensions
- Random::StringExtensions::Self
- FileUtils
- FileUtils::DryRun
- FileUtils::NoWrite
- FileUtils::Verbose
- Digest
- Digest::Class
- Digest::Instance
- Multiton
- Multiton::Inclusive
- Multiton::MetaMethods
- URI
- URI::Hash
- URI::Kernel
- Argvector
- Argvector
- ERB
- ERB::OpenTemplate
- Enumerable
- Enumerable::Arguments
- GetoptLong
- GetoptLong::DSL
- Memoizable
- Memoizable::Copy
- Numeric
- Numeric::Multipliers
- Object
- Object::ArgVector
- Timer
- Timer::Dummy
- Array
- BasicObject
- CGI
- Cloneable
- Continuation
- Date
- DateTime
- Equitable
- File
- Find
- Hash
- Instantiable
- Integer
- Interval
- Kernel
- Math
- Module
- Net
- NilClass
- NullClass
- OpEsc
- OpenStruct
- Pathname
- Platform
- Range
- RbConfig
- Set
- Shellwords
- String
- StringScanner
- Time
- Tuple
- YAML
- Zlib

No matching classes.

# Zlib

A convenient wrapper for the zlib standard library that allows compression/decompression of strings with gzip.

### Public Class Methods

compress(source) click to toggle source

Compresses a string using gzip.

    # File lib/facets/zlib.rb, line 16
    def self.compress(source)
      output = StringIO.new
      class << output
        def close; rewind; end
      end
      gz = GzipWriter.new(output)
      gz.write(source)
      gz.close
      output.string
    end

decompress(source) click to toggle source

Decompresses a gzipped string.

    # File lib/facets/zlib.rb, line 11
    def self.decompress(source)
      GzipReader.new(StringIO.new(source)).read
    end

deflate(string, level=DEFAULT_COMPRESSION) click to toggle source

Deflate a string.

    # File lib/facets/zlib.rb, line 33
    def self.deflate(string, level=DEFAULT_COMPRESSION)
      Deflate.deflate(string, level)
    end

inflate(string) click to toggle source

Inflate a deflated sting.

    # File lib/facets/zlib.rb, line 28
    def self.inflate(string)
      Inflate.inflate(string)
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.