aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorJack Nagel2014-02-08 17:53:00 -0500
committerJack Nagel2014-02-08 17:53:08 -0500
commitd01c671d74ddafcbc0c8dc8eaa805d971e7169fc (patch)
treea41ae013c160ff7d095a3601c9fccb3159f18458 /Library
parent0b0d171566bf2794fdcc1a9be040c451f4091ff6 (diff)
downloadbrew-d01c671d74ddafcbc0c8dc8eaa805d971e7169fc.tar.bz2
Drop unnecessary map + compact in search_tap
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/cmd/search.rb10
1 files changed, 7 insertions, 3 deletions
diff --git a/Library/Homebrew/cmd/search.rb b/Library/Homebrew/cmd/search.rb
index 71e1d1720..e7eb26377 100644
--- a/Library/Homebrew/cmd/search.rb
+++ b/Library/Homebrew/cmd/search.rb
@@ -104,9 +104,13 @@ module Homebrew extend self
results = []
GitHub.open "https://api.github.com/repos/#{user}/homebrew-#{repo}/git/trees/HEAD?recursive=1" do |json|
user = user.downcase if user == "Homebrew" # special handling for the Homebrew organization
- json["tree"].map{ |hash| hash['path'] }.compact.each do |file|
- name = File.basename(file, '.rb')
- if file =~ /\.rb$/ and name =~ rx
+ json["tree"].each do |object|
+ next unless object["type"] == "blob"
+
+ path = object["path"]
+ name = File.basename(path, ".rb")
+
+ if path.end_with?(".rb") && rx === name
results << "#{user}/#{repo}/#{name}"
end
end