How to get object reference from inspection-string

Suppose there is a test failing and only an inspection string is shown in the error message.


It would be very convenient to retrieve a reference to the object for further inspection. The following snippet will give you the object if it isn't garbage-collected yet.

ObjectSpace._id2ref '0x007ff706e7eb68'.to_i(16) >> 1

If you are asking about the strange bit shift >> 1 as I am, I'll humbly point you to where you can find some explanation.