From: "Gray, Jeff" Date: 2002-05-22T08:16:45+09:00 Subject: Rewrite this without using eval... I happened upon a situation where I wanted to apply a sequence of operations to two instance variables without replicating the code. Here's the trivial equivalent case, written using eval: -- class Foo def initialize @a = 1 @b = 2 end def inc_iv [:@a, :@b].each { |iv| eval "#{iv} += 1" } end end -- Could someone suggest a way to rewrite "inc_iv" without using eval, without turning the guts of the each block into a method, and without flattening the [:@a, :@b].each{} construct? Thanks in advance! - jeff