title: ruby debugging, attempting to loop through an objects instance variables
body: <p>I am curious if as to whether or not it would be possible to loop through the instance variables of an object and dump out some basic debug information.</p>
  
  <p>I know you can get a list of instance variables by doing object.instance_variables which returns an array of symbolized variables like <code>[:@var1, :@var2, :@etc]</code> My first guess at how to do this was:</p>
  
  <pre><code>obj.instance_variables.each do
    obj.instance_variable_get(var).to_yaml
  end
  </code></pre>
  
  <p>but i am getting the following error: "can't dump anonymous class Class". What might a better approach be?</p>