commands: tweak find_internal_commands.
Use a more typical Ruby style.
This commit is contained in:
parent
2063e0fc52
commit
59238cd343
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user