commands: tweak find_internal_commands.

Use a more typical Ruby style.
This commit is contained in:
Mike McQuaid 2017-10-20 10:19:11 +01:00 committed by GitHub
parent 2063e0fc52
commit 59238cd343

View File

@ -51,11 +51,8 @@ module Homebrew
end
def find_internal_commands(directory)
directory.children.each_with_object([]) do |f, cmds|
if f.file?
next if f.basename.to_s =~ /^\./
cmds << f.basename.to_s.sub(/\.(?:rb|sh)$/, "")
end
end
Pathname.glob(directory/"*")
.select(&:file?)
.map { |f| f.basename.to_s.sub(/\.(?:rb|sh)$/, "") }
end
end