Skip to content

Commit 2ad29a2

Browse files
committed
Prefer find over each
Since we're modifying the load method directly, there should only ever be one previously loaded instance. Suggestion by @egypt.
1 parent d58db72 commit 2ad29a2

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

lib/msf/core/plugin_manager.rb

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,8 @@ def load(path, opts = {})
6969
end
7070

7171
# Force unloading if already loaded
72-
self.each do |plugin|
73-
if plugin.class == klass
74-
unload(plugin)
75-
end
76-
end
72+
plugin = self.find { |p| p.class == klass }
73+
unload(plugin) if plugin
7774

7875
# Create an instance of the plugin and let it initialize
7976
instance = klass.create(framework, opts)

0 commit comments

Comments
 (0)