From: Gerald Ebberink Date: 2007-01-31T19:35:51+09:00 Subject: Re: Accesing the name of an instance from within an method Well here comes the big picture. I have a class contains some data and amongst other things can generate graphs. What I would like to do is to place these graphs in a bunch of files which have unique names (otherwise I end up with always the last graph). Since only the variable (and the data) are different amongst the instances I wonder how I could give them meaning full names like "20070131 var1 XY.jpg" "20070131 var1 Both.jpg " etc. Now I did think about giving the var as an option while creating the instance, but that doesn't help since it is perfectly possible in the code that variable from which the instance is referenced is changed. Now I come to think of it I could try to overload the = operater to let some internal variable be changed when the reference is changed but then I still need the name of the variable. Kind regards Gerald Ebberink -----Original Message----- From: gwtmp01@mac.com [mailto:gwtmp01@mac.com] Sent: dinsdag 30 januari 2007 17:51 To: ruby-talk ML Subject: Re: Accesing the name of an instance from within an method On Jan 30, 2007, at 2:13 AM, Gerald Ebberink wrote: > I am wondering if it is possible to access the name of an instance > from within a method. I'm going to invoke the "What are you trying to do?" rule. If you give this group the bigger picture of what you are trying to accomplish I'm sure we'll give you any number of options other than "you can't do that in Ruby". Gary Wright