From: Sean O'Halpin Date: 2007-11-11T00:37:00+09:00 Subject: Re: local variables, eval, and parsing Maybe something like this is what you're after? config = "foo = 42" source = "def config_vars; #{config}; binding; end; config_vars" kv = eval("local_variables.inject({}) {|h,v| h[v] = eval(v); h}", eval(source)) p kv # >> {"foo"=>42} You might want to use a random string for the method name to avoid name collisions or use an anonymous module but the basics are here. Regards, Sean