aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/keg.rb
diff options
context:
space:
mode:
authorXu Cheng2016-08-05 22:01:32 +0800
committerGitHub2016-08-05 22:01:32 +0800
commita8566c9848122474b92fc8989eec196d5f4fb69b (patch)
tree896c040fb575962be0aeb27bc9a99454f3514d73 /Library/Homebrew/keg.rb
parent38209aadbfe4fd0c6772467c4bc5c63325d53f6c (diff)
downloadbrew-a8566c9848122474b92fc8989eec196d5f4fb69b.tar.bz2
various: eliminate the usage of `any?` (#638)
`any?` is not the opposite of `empty?`. Besides the case that `[false, nil].any?` will return false, `any?`(O(n)) has much worse performance than `empty?`(O(1)).
Diffstat (limited to 'Library/Homebrew/keg.rb')
-rw-r--r--Library/Homebrew/keg.rb6
1 files changed, 3 insertions, 3 deletions
diff --git a/Library/Homebrew/keg.rb b/Library/Homebrew/keg.rb
index 67b66a2dc..f911bb6b4 100644
--- a/Library/Homebrew/keg.rb
+++ b/Library/Homebrew/keg.rb
@@ -253,11 +253,11 @@ class Keg
when :zsh then path.join("share", "zsh", "site-functions")
when :fish then path.join("share", "fish", "vendor_completions.d")
end
- dir && dir.directory? && dir.children.any?
+ dir && dir.directory? && !dir.children.empty?
end
def plist_installed?
- Dir["#{path}/*.plist"].any?
+ !Dir["#{path}/*.plist"].empty?
end
def python_site_packages_installed?
@@ -265,7 +265,7 @@ class Keg
end
def python_pth_files_installed?
- Dir["#{path}/lib/python2.7/site-packages/*.pth"].any?
+ !Dir["#{path}/lib/python2.7/site-packages/*.pth"].empty?
end
def apps