From: Martin Hansen Date: 2010-08-17T23:38:01+09:00 Subject: Making File.open work on gzipped files Hello all, I am trying to write a class for a file parser with an class method for opening files for reading: class Parser def self.open ios = File.open(*args) parser = self.new(ios) if block_given? begin yield parser ensure ios.close end return true else return parser end end end This works nicely, but I would like it to work on gzipped files too. I was thinking about checking the file type using a system call -> `file`.match("gzip") and if that is true then possibly using popen with "|gzip -f". But I have no idea how to get that working in this block context? Cheers, Martin - possibly by detecting the file type using `file` - and then somehow modify -- Posted via http://www.ruby-forum.com/.