From: Alex Young Date: 2006-08-10T16:11:35+09:00 Subject: Re: hash key to var name of value hash key value Une b�vue wrote: > i'd like to now if their is a simpler way to do that : > > IN_NEWS=@h['IN_NEWS'] > > because here i do have to know their is a key of name "IN_NEWS" > > want i want is to affet the value of all the @h['key_name'] to the > variable key_name ??? > > (as far as i remember well it's possible in php then i think this is > also possible in ruby )))) Thinking out loud... hash.each_key{|k| eval("#{k}=hash[#{k}]") } There may be a better way, though... -- Alex