title: Is there an analog of Python's vars() method in Ruby?
body: <p>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:</p>
  
  <pre><code>a = 1
  b = 2
  "%(a)s %(b)s" % vars()
  </code></pre>
  
  <p>Is there an analog of vars() in Ruby? The closest construct I can think of is </p>
  
  <pre><code>local_variables.inject({}) {|res,var| res[var] = eval(var.to_s); res}
  </code></pre>