Skip to content

Commit 0caeee3

Browse files
author
Brent Cook
committed
replace sort with sort_by
1 parent 1a7a5c2 commit 0caeee3

File tree

1 file changed

+1
-8
lines changed

1 file changed

+1
-8
lines changed

lib/msf/core/module_set.rb

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -315,14 +315,7 @@ def each_module_list(ary, opts, &block)
315315
# @return [Array<Array<String, Class>>] Array of arrays where the inner array is a pair of the module reference name
316316
# and the module class.
317317
def rank_modules
318-
self.mod_ranked = self.sort { |a_pair, b_pair|
319-
a_rank = module_rank(*a_pair)
320-
b_rank = module_rank(*b_pair)
321-
322-
# Compare their relevant rankings. Since we want highest to lowest,
323-
# we compare b_rank to a_rank in terms of higher/lower precedence
324-
b_rank <=> a_rank
325-
}
318+
self.mod_ranked = self.sort_by { |pair| module_rank(*pair) }.reverse!
326319
end
327320

328321
# Retrieves the rank from a loaded, not-yet-loaded, or unloadable Metasploit Module.

0 commit comments

Comments
 (0)