Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.ruby > #6762

Re: what's object_id in irb?

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!nuzba.szn.dk!pnx.dk!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From Robert Klemme <shortcutter@googlemail.com>
Newsgroups comp.lang.ruby
Subject Re: what's object_id in irb?
Date Tue, 05 Mar 2013 22:35:03 +0100
Lines 30
Message-ID <apn6ogFu075U1@mid.individual.net> (permalink)
References <2c64d5aa-e5a3-4db4-b442-daeace8cb263@googlegroups.com>
Mime-Version 1.0
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
X-Trace individual.net 4mAKQLC3KEMPjAb0QAUxHQ4zy5xxOYJXUFqQzfrPjzdpXmC+fqNsIPbzU4+n5RK4E=
Cancel-Lock sha1:GouThYs13cDLDP35bguO4nlKl5g=
User-Agent Mozilla/5.0 (Windows NT 6.0; WOW64; rv:17.0) Gecko/20130215 Thunderbird/17.0.3
In-Reply-To <2c64d5aa-e5a3-4db4-b442-daeace8cb263@googlegroups.com>
X-Antivirus avast! (VPS 130305-0, 05.03.2013), Outbound message
X-Antivirus-Status Clean
Xref csiph.com comp.lang.ruby:6762

Show key headers only | View raw


On 05.03.2013 17:30, Massimo Donati wrote:
> 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


-- 
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/

Back to comp.lang.ruby | Previous | NextPrevious in thread | Find similar


Thread

what's object_id in irb? Massimo Donati <mass.donati@gmail.com> - 2013-03-05 08:30 -0800
  Re: what's object_id in irb? Robert Klemme <shortcutter@googlemail.com> - 2013-03-05 22:35 +0100

csiph-web