From: Brian Candler Date: 2010-07-16T01:39:06+09:00 Subject: Re: Can't change the value of self Ralph Shnelvar wrote: > I have been taught that "an object should take care of itself" ... It can take care of itself, it can't turn into someone else :-) If YAML.load is returning an instance of class UD_Config directly, then just return that to the user. Make a class method, so they call res = UD_Config.load(...) instead of res = UD_Config.new(...) Otherwise, YAML.load is returning some other object - possibly a Hash - with which you wish to initialize your new UD_Config object. So you need to copy values out of that object into your object's instance variables. If YAML.load gives an object with instance variables, you can copy them in a loop: look at 'instance_variables' and 'instance_variable_get' / 'instance_variable_set' -- Posted via http://www.ruby-forum.com/.