class
ActiveSupport::DescendantsTracker::WeakSet
rails latest stable
- Superclass: ObjectSpace::WeakMap
On MRI `ObjectSpace::WeakMap` keys are weak references. So we can simply use WeakMap as a `Set`.
On TruffleRuby `ObjectSpace::WeakMap` keys are strong references. So we use `object_id` as a key and the actual object as a value.
JRuby for now doesn’t have Class#descendant, but when it will, it will likely have the same WeakMap semantic than Truffle so we future proof this as much as possible.
Files
- activesupport/lib/active_support/descendants_tracker.rb