get info from object_id

P

Peña, Botp

Hi All,

apologies in advance if this is so stupid for you (my feeble mind is =
working feebly :)

so here goes,

Given an object_id, how do i get back the object that id stands for?

i'm looking for something like,

a=3D[1,2,3]
x=3Da.object_id
b=3DObject.id_to_object(x) #-> returns object pointed by a wc =
[1,2,3]
b.class #-> returns Array
b #-> [1,2,3]
b =3D=3D a #-> true


thank you and kind regards -botp
 
P

Peña, Botp

From: Joel VanderWerf [mailto:[email protected]] :
# > Given an object_id, how do i get back the object that id stands for?
#=20
# ObjectSpace._id2ref is what you're looking for.

yikes! objectspace is the key word. should have done qri object -Osa in =
the first place. arrghhh..

many thanks again, Joel.
kind regards -botp
 
J

Joel VanderWerf

Peña said:
yikes! objectspace is the key word. should have done qri object -Osa in the first place. arrghhh..

Thanks for reminding me about qri.

What does the "s" do? I see "a", but not "s" in the help for -O:

-O, --order ORDER Specify lookup order.
(default: eEnNpPxX)
Uppercase: case-indep.
e:exact n:nested p:partial
(completion)
x:nested and partial m:complete
namespace
f:complete both class and method
a:match method name anywhere
 
P

Peña, Botp

From: Joel VanderWerf [mailto:[email protected]] :
# Pe=F1a wrote:
# > yikes! objectspace is the key word. should have done qri=20
# object -Osa in the first place. arrghhh..
#=20
# Thanks for reminding me about qri.
#=20
# What does the "s" do? I see "a", but not "s" in the help for -O:
#=20
# -O, --order ORDER Specify lookup order.
# (default: eEnNpPxX)
# Uppercase: case-indep.
# e:exact n:nested p:partial=20
# (completion)
# x:nested and partial m:complete=20
# namespace
# f:complete both class and method
# a:match method name anywhere


Oh, i'm sorry, i tend to mixup qri options with ls (i usually do ls =
-oSa). I used -S for full text, so that should be

qri object -SOa

I usually pipe it then to less, since it's full text search output,

qri object -SOa | less

On this current case, i should have taken a quick peek first by piping =
it to grep like eg,

C:\family\ruby>qri object -SOa | less | grep -i object_id
... r =3D ObjectSpace._id2ref(s.object_id) #=3D> 'I am a string'
... ethod: object_id
... Document-method: object_id
and no two active objects will share an id. Object#object_id is a
share an id. Object#object_id is a different concept from the :name
Found in system Object#object_id
objects will share an id. Object#object_id is a different concept
and no two active objects will share an id. Object#object_id is a
share an id. Object#object_id is a different concept from the :name
... Soon-to-be deprecated version of Object#object_id.
... p res.body.object_id # 538149362
... p res.read_body.object_id # 538149362

There, first hit hints at id2ref.. =20

btw, this is qri, wc is the slower brother of the faster fri; but then =
qri is a lot faster than the original ri, but you were much faster :), =
so..

thanks and kind regards -botp
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,680
Members
48,796
Latest member
Greg L.

Latest Threads

Top