From: Austin Ziegler Date: 2003-09-13T13:36:00+09:00 Subject: Re: fyi : rexml eruby cache'ing On Sat, 13 Sep 2003 11:55:19 +0900, paul vudmaska wrote: > now, instead, i do this > $globalFile = File.new('xml/global.xml') > $global = REXML::Document.new($globalFile) > $globalFile.close There are two Ruby idioms that you may prefer to this. 1. File.open with a block: globalXML = nil File.open("xml/global.xml") do |f| globalXML = REXML::Document.new(f) end This implicitly closes the file at the end of the block. 2. File.read: globalXML = REXML::Document.new(File.read("xml/global.xml")) -austin P.S. Top posting is the practice of replying before the quoted text. It is particularly frowned upon when the entire quoted message is included following the reply. -- austin ziegler * austin@halostatue.ca * Toronto, ON, Canada software designer * pragmatic programmer * 2003.09.13 * 00.31.58