Dump objects attributes
You can dump a objects attributes using
inspect and you can even extend it.
Adding an inspect method to your class allows you to define how the class’ attributes are displayed, rather than rely on default output. A lot of classes don’t implement it well, but it can be really useful when debugging. Ruby will fall back to to_s if it can’t find an inspect` method
Do note that this works for all data types, not just objects. And there is even an alternative do see