#!/usr/bin/env ruby class A attr_accessor :a def initialize a @a = a end def == other @a.size == other.a.size end alias :eql? :== def hash @a.hash end end a = A.new 'a' b = A.new 'b' ax = A.new 'a' puts a == ax l = [a, b, ax] puts l.uniq.size