There should be a way to rehash a
s = Set.new([]) s.first << 1 # s.rehash # Does not exist! s.include?  # => false, want true
#5 Updated by Marc-Andre Lafortune about 3 years ago
headius (Charles Nutter) wrote:
Is it specified that Set must be hashtable-based forever? There are alternate ways to implement a Set.
Alternate ways of implementing Set with check/insertion in O(1) that would also work if structures change without a
In any case, the documentation states that "Set uses Hash as storage", but more importantly that "The equality of each couple of elements is determined according to
Object#eql? and Object#hash".¶
#6 Updated by Akinori MUSHA over 2 years ago
Actually, an undocumented "feature" is that Set does not support an element being modified once it is added.
Maybe we should "clarify" that in the document, or add such a method that recalculates identities of elements. I'm yet to decide which, and the name we could give it.
- rehash (let's be honest)
- reset (re-set the set)