From: Dean Wampler Date: 2007-11-03T05:41:25+09:00 Subject: Re: How do I tell the difference between a class C and the singleton class of an instance of C ------=_Part_16153_31832292.1194036086386 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline I just figured out a way, if I also have the instance "c". c.instance_of?(C) # => true c.instance_of?(sing) # => false Also works for kind_of? and is_a? Thanks, Dean! ;) On 11/2/07, Dean Wampler wrote: > > Suppose that: > > class C; end > c = C.new > sing = (class << c; self; end) > > If a method is called with C and sing, but I don't know which is first and > which is second in the parameter list, how do I tell them apart? > > Thanks, > dean > > -- > Dean Wampler > http://www.objectmentor.com > http://www.aspectprogramming.com > http://aquarium.rubyforge.org > http://www.contract4j.org -- Dean Wampler http://www.objectmentor.com http://www.aspectprogramming.com http://aquarium.rubyforge.org http://www.contract4j.org ------=_Part_16153_31832292.1194036086386--