Zipping a folder of .tar.gz extension using ruby code

hi i want to zip a filename.tar.gz extension how can i do this?

I just had to do that on a recent contribution to the Ruby git gem.

For tar, use minitar gem, a pure Ruby tar compression gem.

For gz, Ruby has built in support for gzip with Zlib