what's object_id in irb?

M

Massimo Donati

Hi everyone i'm running this lines of code:

[home/] irb
2.0.0p0 :001 > object_id
=> 70156571578960


I can't really understand what is this object_id referred to since is not called from any object?

Thanks very much!
Massimo
 
R

Robert Klemme

Hi everyone i'm running this lines of code:

[home/] irb
2.0.0p0 :001 > object_id
=> 70156571578960


I can't really understand what is this object_id referred to since is not called from any object?

It is:

irb(main):001:0> object_id
=> -1073529238
irb(main):002:0> self
=> main
irb(main):003:0> self.object_id
=> -1073529238

Note: self - as any variable - _always_ (no exception!) references an
instance.

Cheers

robert
 

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

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top