From: pere.noel@... (=?ISO-8859-1?Q?Une_b=E9vue?=) Date: 2006-02-09T22:38:22+09:00 Subject: Re: yaml object de-serialisation David Vallner wrote: First, thanks for your reply )) > What do you mean by Preferences including Themes? If you mean instances of > Theme are instance variables of Preferences, or are stored in an Array in > Preferences, you shouldn't need to repopulate anything. > yes i have another class Theme and Preferences class includes an array of instances of Theme. > I didn't quite understand the intent of your code, but it looks like you're > doing copies of themes from o.themes_list to another Array @themes_list... > Why can't you keep them in the original object "o" and access them from > there? ok, i see xhat you mean. three cases : - first launch of this app whithout any prefs saved: i create a default prefs by : prefs=Preferences.new blahblahblah prefs.save #ie to a yaml file - not first launch of this app with an instance of Preferences saved : prefs=YAML::load(File.open("#{PREFS_FILE}")) that's all now the third case i've an old way to save prefs into a yaml file, basically a hash instead of an instance of Preferences in that case i only have to add another method to the Preferences class, saying : prefs=Preferences.new prefs.updateFromOlderFileStructure prefs.save again, that's all. am i right ? -- une b�vue