在Ruby中,如果我将对象实例的ID作为字符串,例如
"#<Meeting:0x4531860>"
,我可以通过此ID获取实例吗?
# what I want
meeting = SOME_MAGIC_HERE "#<Meeting:0x4531860>"
# and then I can handle the meeting itself
meeting.name # => 'BLABLABLA'
答案 0 :(得分:2)
meeting = ObjectSpace._id2ref(0x4531860 >> 1)