From: Thomas Adam Date: 2006-09-28T07:09:11+09:00 Subject: Re: Idiomatic file snarf On Thu, 28 Sep 2006 07:02:13 +0900 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? I must be looking in > the wrong place @ruby-doc.org -Tim some_variable = File.new(fname).readlines -- Thomas Adam -- "If I were a witch's hat, sitting on her head like a paraffin stove, I'd fly away and be a bat." -- Incredible String Band.