Is comparing on `@rule` enough? If two objects have the same rule but different document objects would they be considered the same? Also note how `#hash` uses different object.

You may want to consider using my equalizer gem here. You could specify the parameters that need to be compared for two objects to be equivalent.