From: Jean-denis Vauguet Date: 2010-09-22T02:06:46+09:00 Subject: temporarily override instance variable in a block Hi, I strived to override instance variable on a per-block basis, but I'm not satisfied with my results. Here's a snippet: http://gist.github.com/589924 The goal is: execute a block but have it use a different value for a previously defined instance variable, all of this in the context of a class instance (the instance variable belongs to this class instance). Two approach are illustrated: variable swapping and instance_eval. The former does the trick but it's cumbersome and not thread-safe. The latter, I don't understand why, fails, for the block seems to be called in the If anyone can help with this, thanks in advance! -- Posted via http://www.ruby-forum.com/.