From: Lyle Johnson Date: 2002-11-20T05:30:25+09:00 Subject: Re: Symbol usage help ahoward wrote: > rubyists- > > given > > a = 42 > b = 'forty-two' > > is it possible to do something like : > > %w( a b ).each do |s| > puts "#{s} = #{s.intern.value}" > end > > to output > > a = 42 > b = forty-two > > obviously, the Symbol#value method does not exist, but this should be clear > enough... What about this? a = 42 b = 'forty-two' %w( a b ).each do |s| puts "#{s} = #{eval(s.intern.to_s)}" end Lyle