From: James Edward Gray II Date: 2006-09-28T07:06:33+09:00 Subject: Re: Idiomatic file snarf On Sep 27, 2006, at 5:02 PM, Tim Bray wrote: > I want to open a file, suck the contexts into a variable and close > it again. I suppose I could IO#each and glue the lines together. > > Currently I have > > f = File.new(fname) > text = f.read > f.close > > Surely there's an idiomatic Ruby one-liner? Sure: text = File.read(fname) James Edward Gray II