diff options
| author | Jack Nagel | 2014-06-07 17:45:13 -0500 |
|---|---|---|
| committer | Jack Nagel | 2014-06-07 21:15:24 -0500 |
| commit | 48d80dd9881185b91b96d9c6096f64290dcc6255 (patch) | |
| tree | 479e1420c7aa3b757cfe1b21822906e968e92292 | |
| parent | aa6ebf586083d6f33dfd976f1399cf0d4f5e7277 (diff) | |
| download | homebrew-48d80dd9881185b91b96d9c6096f64290dcc6255.tar.bz2 | |
metafiles: reduce pathname conversions in #include?
| -rw-r--r-- | Library/Homebrew/metafiles.rb | 19 |
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 |
