1

在 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'
4

1 回答 1

2
meeting = ObjectSpace._id2ref(0x4531860 >> 1)
于 2013-08-23T02:15:39.980 回答