Thursday 22 August 2013

Ruby: Can I get an instance by its ID?

Ruby: Can I get an instance by its ID?

In Ruby, if I have the ID of an object instance as a string, such as
"#<Meeting:0x4531860>", can I get the instance its self by this ID?
# what I want
meeting = SOME_MAGIC_HERE "#<Meeting:0x4531860>"
# and then I can handle the meeting itself
meeting.name # => 'BLABLABLA'

No comments:

Post a Comment