From: Josh French Date: 2008-07-04T09:31:49+09:00 Subject: Extract local variables from a block? Is it possible to extract local variables from within a block, while standing outside said block? Here's an example which might illustrate what I'm trying to do: def local_vars_from(&block) eval('local_variables', block).each do |var| new_local_var = eval(var, block) end end local_vars_from do unknown_local_var = :blah end Of course, this example doesn't work at all. What I'm trying to accomplish is a new variable in the current scope which mirrors the variable inside the block. I'm pretty sure I'm misusing local_variables; is there another approach to this? Thanks, j