From: Tim Hunter Date: 2008-01-05T00:16:11+09:00 Subject: Re: Checking an array for an item Sam Phoneix wrote: > How come this code doesn't return "true" for the following? > > x = [1,2,3] > > puts(x.include?(Fixnum)) > > > > Thanks Because include? doesn't test the class of an object, it tests for the presence of an object. The ri command is your friend here: $ ri Array.include? --------------------------------------------------------- Array#include? array.include?(obj) -> true or false ------------------------------------------------------------------------ Returns true if the given object is present in self (that is, if any object == anObject), false otherwise. a = [ "a", "b", "c" ] a.include?("b") #=> true a.include?("z") #=> false -- RMagick: http://rmagick.rubyforge.org/ RMagick 2: http://rmagick.rubyforge.org/rmagick2.html