Skip to content

Commit 0cf2c3b

Browse files
committed
Refactor LSI class methods for improved readability and correctness
- Add parentheses to method call in '<<' method - Replace 'contain?' with 'key?' in remove_item method - Change 'remove' to 'delete' for hash removal in remove_item method
1 parent 28b10b9 commit 0cf2c3b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/classifier/lsi.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ def add_item(item, *categories, &block)
7171
# will be duck typed via to_s .
7272
#
7373
def <<(item)
74-
add_item item
74+
add_item(item)
7575
end
7676

7777
# Returns the categories for a given indexed items. You are free to add and remove
@@ -85,9 +85,9 @@ def categories_for(item)
8585
# Removes an item from the database, if it is indexed.
8686
#
8787
def remove_item(item)
88-
return unless @items.keys.contain? item
88+
return unless @items.key?(item)
8989

90-
@items.remove item
90+
@items.delete(item)
9191
@version += 1
9292
end
9393

0 commit comments

Comments
 (0)