I think that rather than creating a new class, adding an option on Set.new (e.g. Set.new([a_str, a_str, "b", "b"], compare_by: :identity)) is more Ruby-like.
I submitted this as a patch because the std lib already contains one subclass of Set (SortedSet) and a commented-out implementation of another (RestrictedSet).
I don’t expect that this class will change beyond the initial implementation. Following the precedent of SortedSet, I think that including IdentitySet in the std lib improves discoverability over providing it via a gem, which seems like a more heavyweight solution for a simple, useful variation on a Set.
I was surprised that there wasn't already a standard way to do this.
Note that SortedSet#compare_by_identity is unimplemented when SortedSet uses rbtree.
rbtree.readjust { |a, b| a.object_id <=> b.object_id } comes pretty close, but rbtree treats string keys specially by storing a copy of each string key given, so it does not work as expected for string keys. There needs some way provided on the rbtree side.