aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/extend
diff options
context:
space:
mode:
authorMarkus Reiter2016-08-24 12:32:17 +0200
committerGitHub2016-08-24 12:32:17 +0200
commitfa19447a2d9d311909452ee35b309d08558c9a3a (patch)
tree5b0ca185d5fd05dddc9cc5bdde563a44947487fd /Library/Homebrew/extend
parentff7d3f226ae3b2bd216539d10b1724b18be1a127 (diff)
parent85635a1e1927281edbf55ac0214357fd184c70bc (diff)
downloadbrew-fa19447a2d9d311909452ee35b309d08558c9a3a.tar.bz2
Merge pull request #793 from reitermarkus/refactoring-pathname
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)