From: Simon Krahnke Date: 2008-04-30T21:35:02+09:00 Subject: Re: undefined local variable * ts (2008-04-28) schrieb: > def the_class.load_from_file(filename) > yaml_dict = YAML::load(File.open(filename)) > object_list = yaml_dict[yaml_dict.keys[0]].map do |from_file| > puts "from_file: #{from_file}" > new_obj = new > from_file.map do |obj| > puts "obj: #{obj}" > obj_as_list = obj.to_a Why not attr, value = *obj.to_a > puts "obj_as_list: #{obj_as_list}" > new_obj.send("#{obj_as_list[0]}=", obj_as_list[1]) And use attr and value instead of ...[0] and ...[1]. > end > new_obj > end > object_list > end The object_list variable seems to be useless, the method would return value without it. mfg, simon .... l