How can I decompress a Gzip string in Ruby?

Zlib::GzipReader can take "an IO, or IO-like, object." as its input, as stated in the documentation. Zlib::GzipReader.open('hoge.gz') {|gz| print gz.read } File.open('hoge.gz') do |f| ...