Sha256: bef1936cbbafe081a3b2ea014e2b9d62e4a198d9bf94ef8bd20df2823cd19b15
Contents?: true
Size: 619 Bytes
Versions: 11
Compression:
Stored size: 619 Bytes
Contents
require 'zlib' require 'lzoruby' module GZIP def self.compress string, level z = Zlib::Deflate.new level dst = z.deflate string, Zlib::FINISH z.close dst end def self.decompress string zstream = Zlib::Inflate.new buf = zstream.inflate string zstream.finish zstream.close buf end end class Archive attr_reader :type def initialize type type = type.to_s puts_fail "Unsupported type" unless %w[lzo gzip].include? type.downcase instance_eval %{@type = #{type.upcase}} end def method_missing name, *args StringIO.new @type.send(name, *args) end end
Version data entries
11 entries across 11 versions & 1 rubygems