From: Dave Thomas Date: 2004-01-05T01:14:35+09:00 Subject: Re: When did IO::read appear? On Jan 4, 2004, at 9:41, Bil Kleb wrote: > I wrote some code on a ruby 1.7.2 (2002-05-29) machine using > IO.read, but when I moved it to a ruby 1.6.8 (2002-12-24) > machine I got an exception, > > NameError: undefined method `read' for IO:Class > > What's the idiomatic workaround for this sort of thing? To be backwards compatible, you can use: content = File.open(name) { |f| f.read} Cheers Dave