In Python there is vars() method which returns a dictionary of names of local variables as keys, and their values, so it is possible to do something like this:
a = 1
b = 2
"%(a)s %(b)s" % vars()
Is there an analog of vars() in Ruby? The closest construct I can think of is
local_variables.inject({}) {|res,var| res[var] = eval(var.to_s); res}