aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJack Nagel2014-06-07 17:45:13 -0500
committerJack Nagel2014-06-07 21:15:24 -0500
commit6524dfc17b95c2944829f8264300cf60d49f5250 (patch)
treed8647c5c550645a12b41b6ebee67134c0cfef0e5
parentcad5704fc77ee0271e32b2fb624eec7aa662748b (diff)
downloadbrew-6524dfc17b95c2944829f8264300cf60d49f5250.tar.bz2
metafiles: reduce pathname conversions in #include?
-rw-r--r--Library/Homebrew/metafiles.rb19
1 files changed, 9 insertions, 10 deletions
diff --git a/Library/Homebrew/metafiles.rb b/Library/Homebrew/metafiles.rb
index e01ca2f15..9f740781f 100644
--- a/Library/Homebrew/metafiles.rb
+++ b/Library/Homebrew/metafiles.rb
@@ -22,17 +22,16 @@ class Metafiles
private
- def include? p
- p = p.to_s # Might be a pathname
- p = p.downcase
- path = Pathname.new(p)
- if @exts.include? path.extname
- p = path.basename(path.extname)
+ def include?(path)
+ path = path.to_s.downcase
+ ext = File.extname(path)
+
+ if EXTENSIONS.include?(ext)
+ file = File.basename(path, ext)
else
- p = path.basename
+ file = File.basename(path)
end
- p = p.to_s
- return @metafiles.include? p
- end
+ return @metafiles.include?(file)
+ end
end