David Vallner <david / vallner.net> wrote: > If the above pattern doesn't cover what you need, you can always create more > factory methods to crunch for example the old structure into one the > constructor will like better. yes, that's another solution. I'll think about your above solution (options hash) because i don't like the way i've done that actually mostly because, i, my case, the #initialize is more orl es a fake initialise : it returns somehow an empty object. > > > > suppose now, in the live of this app, i'll add some new attributes to > > the class Preferences, what is the behaviour of yaml in that case ? > > > > i suppose the new attributes (if an instance of Preferences is loaded > > from older attributes list) will be nill ? > > Yes, the YAML loader doesn't know anything about what instance attributes the > object is supposed to have. AFAIK, it uses Object::allocate to create a blank > instance of the class, then populates the instance variables via > Object#instance_variable_set, or something equivalent. OK, thanks for all. -- une bñ×ue