From: Mark Noworolski Date: 2006-12-11T05:19:40+09:00 Subject: Question on IO objects, initialize, and yaml ------=_Part_71450_19955042.1165781977504 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline Say I have a class with pseudo code as follows: class Test def initialize @a=1 @b=File.open("file+Time.now or similar") end end Now, imagine that I use this class for a while and then I want to dump it to a YAML file. When I restart my code, I want it to read in stuff from the YAML file (if it exists) and use that as a starting point to work from (basically, I am saving state in the yaml file). You'll note that I cannot just do this as is, because reading in from YAML does not initialize the class, so @b would not be initialized correctly on restart. I'd like to just initialize the thing, then read in the YAML file to overwrite the state with the saved values. Is there some extremely obvious ruby way to do this or something equivalent? Thanks, mark ------=_Part_71450_19955042.1165781977504--