Multiple instance_of?

Posted by c00lryguy on Stack Overflow See other posts from Stack Overflow or by c00lryguy
Published on 2010-05-06T03:54:19Z Indexed on 2010/05/06 3:58 UTC
Read the original article Hit count: 192

Filed under:

How would I make Object#instance_of? accept multiple arguments so that something like the below example would work?

class Foo; end
class Bar; end
class Baz; end

my_foo = Foo.new
my_bar = Bar.new
my_baz = Baz.new

my_foo.instance_of?(Foo, Bar) # => true
my_bar.instance_of?(Foo, Bar) # => true
my_baz.instance_of?(Foo, Bar) # => false

© Stack Overflow or respective owner

Related posts about ruby