#!/usr/bin/env ruby
class X
def initialize(var)
@attribute = var
end
def attribute
@attribute
end
end
x = [X.new(1), X.new(2), X.new(3)]
y = [X.new(1), X.new(2), X.new(4)]
not_in_y = x.reject{ |x_item| y.index { |y_item| x_item.attribute == y_item.attribute } }
not_in_x = y.reject{ |y_item| x.index { |x_item| x_item.attribute == y_item.attribute } }
p not_in_y
p not_in_x
IyEvdXNyL2Jpbi9lbnYgcnVieQoKY2xhc3MgWAogIGRlZiBpbml0aWFsaXplKHZhcikKICAgIEBhdHRyaWJ1dGUgPSB2YXIKICBlbmQKCiAgZGVmIGF0dHJpYnV0ZQogICAgQGF0dHJpYnV0ZQogIGVuZAplbmQKCnggPSBbWC5uZXcoMSksIFgubmV3KDIpLCBYLm5ldygzKV0KeSA9IFtYLm5ldygxKSwgWC5uZXcoMiksIFgubmV3KDQpXQoKbm90X2luX3kgPSB4LnJlamVjdHsgfHhfaXRlbXwgeS5pbmRleCB7IHx5X2l0ZW18IHhfaXRlbS5hdHRyaWJ1dGUgPT0geV9pdGVtLmF0dHJpYnV0ZSB9IH0Kbm90X2luX3ggPSB5LnJlamVjdHsgfHlfaXRlbXwgeC5pbmRleCB7IHx4X2l0ZW18IHhfaXRlbS5hdHRyaWJ1dGUgPT0geV9pdGVtLmF0dHJpYnV0ZSB9IH0KCnAgbm90X2luX3kKcCBub3RfaW5feA==