... or alternatively an Array which prevents duplicate entries.

Is there some kind of object in Ruby which:

  • responds to [], []= and <<
  • silently drops duplicate entries
  • is Enumerable (or at least supports find_all)
  • preserves the order in which entries were inserted
?

As far as I can tell, an Array supports points 1, 3 and 4; while a Set supports 1, 2 and 3 (but not 4). And a SortedSet won't do, because my entries don't implement <=>.

Edit
Report