From: Adam Prescott Date: 2011-01-05T19:24:07+09:00 Subject: Re: Is singleton class of an object already created? --90e6ba5bbaf7ced57b049916c82a Content-Type: text/plain; charset=UTF-8 On Tue, Jan 4, 2011 at 9:00 PM, timr wrote: > class Object > def singleton_class? > self.singleton_methods.length == 0 ? false : true > end > end > Really small point here, and not really on topic, but this is a little around the houses and can be slightly improved: class Object def singleton_class? !self.singleton_methods.empty? end end Or just != 0, since it'll return the true/false without the need for a ternary. --90e6ba5bbaf7ced57b049916c82a--