From: Robert Klemme Date: 2011-04-05T21:56:43+09:00 Subject: Re: Autoconvert object from one class1 to other class2 in class1 def On Tue, Apr 5, 2011 at 11:15 AM, Luk Mus wrote: > Brian Candler wrote in post #990955: >>> or how get name of variable in class method? >> >> That's not possible either. The same object could be pointed to by many >> variables (local and/or global and/or instance), or by none. For >> example, maybe the only reference to the object is as a value in a Hash. > > But i can get object_id: > > class String >  def get_id >    puts self.__id__ >    puts self.object_id >  end > end > > Is it realy to get name by ID? No, it isn't. As Brian has pointed out already there can be arbitrary many references to an object and they can be - local variables - member variables - class variables - Array entries - Hash entries Lik, what do you need this for? What is the use case? Cheers robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/