summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-03-01 23:31:56 +0200
committerPaul Buetow <paul@buetow.org>2026-03-01 23:31:56 +0200
commit1ef38a857c895e5f970d219ba6802b2627801620 (patch)
tree3b79793b68ce090e37b80b762124677808b6ddfd /test
parent1217524955c7ea891ea85cb17dfd13f2b7b1fc3d (diff)
refactor: replace ObjectSpace scan with inherited-hook registry
ResourceDependencies#initialize iterated every live object in the Ruby heap (ObjectSpace.each_object(Class)) to discover Resource subclasses, which is O(heap), non-deterministic, and load-order-dependent (subclasses loaded after an instance was created were invisible to it). Add Resource.inherited + @@subclass_names so each subclass self-registers at load time. ResourceDependencies#initialize now just assigns the shared (frozen) registry reference instead of scanning ObjectSpace. Benefits: - O(1) constructor path instead of O(heap) - Load-order safe: new subclasses are visible to all instances immediately - Deterministic: set is built in require order, not GC-dependent order Also fix the "recource" typo in the ResourceDependencies comment. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'test')
0 files changed, 0 insertions, 0 deletions