aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/extend
diff options
context:
space:
mode:
authorMarkus Reiter2016-08-23 02:36:21 +0200
committerMarkus Reiter2016-08-24 00:43:32 +0200
commit85635a1e1927281edbf55ac0214357fd184c70bc (patch)
tree62139240e7241836e80a690b63a1a5c67e9e98fd /Library/Homebrew/extend
parenta70c60baeacf6ec6835fb0112fb5d1c9dd51012a (diff)
downloadbrew-85635a1e1927281edbf55ac0214357fd184c70bc.tar.bz2
Merge Cask’s `Pathname` extension with Homebrew’s.
Diffstat (limited to 'Library/Homebrew/extend')
-rw-r--r--Library/Homebrew/extend/pathname.rb10
1 files changed, 5 insertions, 5 deletions
diff --git a/Library/Homebrew/extend/pathname.rb b/Library/Homebrew/extend/pathname.rb
index c9cc9d3f3..324f72d1e 100644
--- a/Library/Homebrew/extend/pathname.rb
+++ b/Library/Homebrew/extend/pathname.rb
@@ -216,10 +216,10 @@ class Pathname
# extended to support common double extensions
def extname(path = to_s)
- BOTTLE_EXTNAME_RX.match(path)
- return $1 if $1
- /(\.(tar|cpio|pax)\.(gz|bz2|lz|xz|Z))$/.match(path)
- return $1 if $1
+ bottle_ext = path[BOTTLE_EXTNAME_RX, 1]
+ return bottle_ext if bottle_ext
+ archive_ext = path[/(\.(tar|cpio|pax)\.(gz|bz2|lz|xz|Z))$/, 1]
+ return archive_ext if archive_ext
File.extname(path)
end
@@ -445,8 +445,8 @@ class Pathname
end
end
+ # https://bugs.ruby-lang.org/issues/9915
if RUBY_VERSION == "2.0.0"
- # https://bugs.ruby-lang.org/issues/9915
prepend Module.new {
def inspect
super.force_encoding(@path.encoding)