From: ara.t.howard@... Date: 2005-12-19T12:43:34+09:00 Subject: Re: shortcut to self.class ? On Mon, 19 Dec 2005, Mark J.Reed wrote: > Without writing my own alias, is there an easy way to get the class of > the current object without calling self.class? I'm trying to call class > methods from within an instance method, and self.class.method_name is > just a little verbose for my taste. I could do type.method_name, but > that's deprecated and not very clear. It would be nice if just class > by itself were understood in context as the method instead of the keyword, > but since it's not, I'm sort of stuck. Suggestions? class Object def klass self.class end end often i simply put this in specific classes. i also put this one in alot class Object def singleton_class class << self; self; end end end it defintely best if you can keep this in your own code - but sometimes putting global like this makes sense. regards. -a -- =============================================================================== | ara [dot] t [dot] howard [at] noaa [dot] gov | all happiness comes from the desire for others to be happy. all misery | comes from the desire for oneself to be happy. | -- bodhicaryavatara ===============================================================================