Hi Dave:

Thanks for the reply.

You instantiated AnArray. Try this:

class AnArray < Array; end

AnArray.kind_of?( Array )       will return false

is_a? doesn't work on the class object. I don't know if it supposed to but 
other than creating an instance the only alternative is a loop requesting the 
superclass.

AnArray.superclass == Array  will return true

Bob Rice


On Jan 19, 2011, at 4:14 PM, Dave Baldwin wrote:

> Have you tried kind_of? method, 
> 
> i.e. 
> 
> class AnArray < Array
> end
> 
> a = AnArray.new
> 
> a.kind_of? Array              will return true
> a.kind_of? String                     will return false
> 
> assuming I haven't miss understood your question.
> 
> Dave.
> 
> On 19 Jan 2011, at 21:06, Robert Rice wrote:
> 
>> Hi:
>> 
>> I notice that the obj.is_a? method does not work on a class constant. It 
>> only works on an instance of the class.
>> 
>> Is this the way it should work? Do I need to create a loop checking using 
>> the superclass method to check the inheritance of a class or is there an 
>> easier way?
>> 
>> Thanks,
>> Bob Rice
>> 
>> _______________________________________________
>> MacRuby-devel mailing list
>> MacRuby-devel@lists.macosforge.org
>> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
> 
> _______________________________________________
> MacRuby-devel mailing list
> MacRuby-devel@lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
> 

_______________________________________________
MacRuby-devel mailing list
MacRuby-devel@lists.macosforge.org
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel

Reply via email to