I have searched around, but can't find any built-in way to do convert an object (of my own creation) to a hash of values, so must needs look elsewhere.
My thought was to use .instance_variables
, strip the @
from the front of each variable, and then use the attr_accessor
for each to create the hash.
What do you guys think? Is that the 'Ruby Way', or is there a better way to do this?