title: How to get the name of an object in Ruby?
body: <p>I want to write a simple debug method in Ruby for my Rails app:</p>
  
  <pre><code>foo = "bar"
  debug(foo)
  </code></pre>
  
  <p>The debug method would return the string <code>"foo: bar"</code>.</p>
  
  <p>How do you get the name of the object (foo, in this case) in Ruby?</p>
  
  <p>Working in Ruby 1.92.</p>
  
  <p>Thanks.</p>