lib/archive.rb in encbs-0.2.1 vs lib/archive.rb in encbs-0.2.2
- old
+ new
@@ -6,11 +6,11 @@
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
@@ -20,13 +20,14 @@
class Archive
attr_reader :type
def initialize type
- puts_fail "Unsupported type" unless [:lzo, :gzip].include? type.downcase
- instance_eval %{@type = #{type.to_s.upcase}}
+ 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
\ No newline at end of file
+end