aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike McQuaid2016-09-10 10:24:56 +0100
committerMike McQuaid2016-09-11 17:58:58 +0100
commit128729988ed8feadbdac31d4edd613c5afa64d24 (patch)
treea98cdc40e7e48fa89ad91937c2d40c1507f30e81
parent984e80a7c2624baa88bad1ab1bc822d1e98292c7 (diff)
downloadbrew-128729988ed8feadbdac31d4edd613c5afa64d24.tar.bz2
cmd/commands: fix Rubocop warnings.
-rw-r--r--Library/Homebrew/cmd/commands.rb6
1 files changed, 2 insertions, 4 deletions
diff --git a/Library/Homebrew/cmd/commands.rb b/Library/Homebrew/cmd/commands.rb
index b8407d668..87dca8e79 100644
--- a/Library/Homebrew/cmd/commands.rb
+++ b/Library/Homebrew/cmd/commands.rb
@@ -41,22 +41,20 @@ module Homebrew
end
def external_commands
- paths.reduce([]) do |cmds, path|
+ paths.each_with_object([]) do |path, cmds|
Dir["#{path}/brew-*"].each do |file|
next unless File.executable?(file)
cmd = File.basename(file, ".rb")[5..-1]
cmds << cmd unless cmd.include?(".")
end
- cmds
end.sort
end
private
def find_internal_commands(directory)
- directory.children.reduce([]) do |cmds, f|
+ directory.children.each_with_object([]) do |f, cmds|
cmds << f.basename.to_s.sub(/\.(?:rb|sh)$/, "") if f.file?
- cmds
end
end
end