Skip to content

Commit 3a4c122

Browse files
committed
Make sure deleted object's entries are removed from object_types
1 parent 1aae740 commit 3a4c122

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

lib/yard/registry_store.rb

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,12 @@ def put(key, value)
7272
# Deletes an object at a given path
7373
# @param [#to_sym] key the key to delete
7474
# @return [void]
75-
def delete(key) @store.delete(key.to_sym) end
75+
def delete(key)
76+
if @store[key.to_sym]
77+
@object_types[@store[key.to_sym].type].delete(key.to_s)
78+
@store.delete(key.to_sym)
79+
end
80+
end
7681

7782
# Gets all path names from the store. Loads the entire database
7883
# if +reload+ is +true+

spec/registry_store_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ def saves_to_multidb
305305
end
306306

307307
describe "#delete" do
308-
pending "deletes the given object from store" do
308+
it "deletes the given object from store" do
309309
@store.put(:YARD, @foo)
310310
expect(@store.get(:YARD)).to be @foo
311311
expect(@store.paths_for_type(:method)).to eq ["YARD"]

0 commit comments

Comments
 (0)