I believe include? checks for the specific Object ID for the set, not 
the contents of the set.

-Justin

Timo Hoepfner wrote:
> Hi,
>
> I already mentioned this in another thread, but I think this is of 
> general interest. So sorry, if you read it twice.
>
> While working on something involving the "Set" class of the Ruby 
> standard library, I came across the following:
>
> require "set"
> require "test/unit"
>
> class TestSet < Test::Unit::TestCase
>
>   def test_set
>     array_of_arrays=[["a", "b"]]
>     array_of_sets=array_of_arrays.map{|an_array| an_array.to_set}
>     set_of_sets=array_of_sets.to_set
>     contained_array=["a","b"]
>     contained_set=contained_array.to_set
>     # OK
>     assert_equal(true, array_of_arrays.include?(contained_array))
>     # OK
>     assert_equal(true, array_of_sets.include?(contained_set))
>     # fails
>     assert_equal(true, set_of_sets.include?(contained_set))
>   end
> end
>
> The third assertion fails. Is this intended behaviour?
>
> Timo
>