diff options
Diffstat (limited to 'Library/Homebrew/cmd/commands.rb')
| -rw-r--r-- | Library/Homebrew/cmd/commands.rb | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/Library/Homebrew/cmd/commands.rb b/Library/Homebrew/cmd/commands.rb index 13395a8c2..0dfc6c451 100644 --- a/Library/Homebrew/cmd/commands.rb +++ b/Library/Homebrew/cmd/commands.rb @@ -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 |
