Asp Forum
Home
|
Login
|
Register
|
Search
Forums
>
comp.lang.ruby
Re: Does an instance know his own name?
e
9/4/2006 2:24:00 AM
Geoff Barnes wrote:
> If a class has built checks and raises an exception if it finds
> something wrong, how can I tell which instance had the error? I know
> there's an object_id, but can I know the name of the objects own
> instance variable?
>
> <snip />
>
> Also, can an instance know his 'path' from the top-level?
>
> <snip />
No and no (at least, no sensible way). You are dealing with
symbolic names 'huey' versus actual references and objects.
The 'proper' way is to have the object know its name:
huey = Nephew.new 'Huey'
> Thanks,
--
Posted via
http://www.ruby-...
.
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
Re: Does an instance know his own name?
Inserendo la tua e-mail nella casella sotto, riceverai un avviso tramite posta elettronica ogni volta che il motore di ricerca troverà un nuovo messaggio per te
Il servizio è completamente GRATUITO!
x
Login to ForumsZone
Login with Google
Login with E-Mail & Password