Hi --

On Wed, 2 Jun 2004, David A. Black wrote:

> So... what you really want to do is:  
> 
>   array.each { |member|
>     case member           # not member.class
>       when Object::Subclass
> 
> etc.  

I realize actually that this isn't identical to what you wanted to do,
since my code will return true for things that are instances of some
subclass of Object::Subclass.  If that's OK, then the above is OK.  If
not, it's possible that you might be better off with an if statement
than a case statement.  

Another thing you could do...  Since each Class object (such as
Object::Subclass) is the only instance of its own singleton class,
you could do:

  case member.class
    when Object::Subclass.singleton_class  # true if and only if
                                           # member.class is
                                           # Object::Subclass

Oh, whoops, Kernel#singleton_class doesn't exist :-)  Here:

  module Kernel
    def singleton_class
      class << self; self; end
    end
  end


David

-- 
David A. Black
dblack / wobblini.net