Updated to work with Ruby 2.0. Had to check object for nil before attempting to build and get and instance variable from it. In ruby 1.8.7 instance_variable_get("@") works. In ruby 2.0 it raises an error - '`@' is not allowed as an instance variable name'