diff options
| author | Mike McQuaid | 2017-10-20 10:19:11 +0100 | 
|---|---|---|
| committer | GitHub | 2017-10-20 10:19:11 +0100 | 
| commit | 59238cd343630104f53b56565f039391d08abd6a (patch) | |
| tree | 339a05a4f48487541c4c9f435713f17b4d820091 /Library/Homebrew/cmd/commands.rb | |
| parent | 2063e0fc523ab780e41ae829c04773fa21827abb (diff) | |
| download | brew-59238cd343630104f53b56565f039391d08abd6a.tar.bz2 | |
commands: tweak find_internal_commands.
Use a more typical Ruby style.
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 | 
