From: "David A. Black" Date: 2010-01-20T10:26:09+09:00 Subject: Re: Looking for object.inherits?(Classname) Hi -- On Wed, 20 Jan 2010, Xeno Campanoli wrote: > I'm looking for a way to make sure an object being passed is in some class > family, or to say it otherwise, inherits some specific class, but not > necessarily directly. In fact, it could be a great-great-grandparent class, > and that would be okay, and needs to be okay. Is there something where I can > take an object and go > > unless object.inherits?(MyClass) > raise SyntaxError, "etc." > end > > > ????? > > Sorry, but could not find this in my pickaxe book. object.is_a?(MyClass) or object.kind_of?(MyClass) (same method, two different names). David -- David A. Black Senior Developer, Cyrus Innovation Inc. THE COMPLEAT RUBYIST, Ruby training with Black/Brown/McAnally! January 22-23, Tampa, Florida Info and registration at http://www.thecompleatrubyist.com