aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorJack Nagel2014-04-05 17:41:36 -0500
committerJack Nagel2014-04-05 17:41:36 -0500
commitce367e711be8e4f2a08357705dafa5bc375da99b (patch)
tree2b3aba1d7764345f9f187c3436e5e71a01c78a4e /Library
parent8c88d48af70e4d9705f0401bcddfed94db84fa83 (diff)
downloadbrew-ce367e711be8e4f2a08357705dafa5bc375da99b.tar.bz2
Prefer File.extname to regexp
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/formulary.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/Library/Homebrew/formulary.rb b/Library/Homebrew/formulary.rb
index c36635732..232e2a108 100644
--- a/Library/Homebrew/formulary.rb
+++ b/Library/Homebrew/formulary.rb
@@ -115,7 +115,7 @@ class Formulary
def initialize path
# require allows filenames to drop the .rb extension, but everything else
# in our codebase will require an exact and fullpath.
- path = "#{path}.rb" unless path =~ /\.rb$/
+ path = "#{path}.rb" unless File.extname(path) == ".rb"
path = Pathname.new(path).expand_path
super path.stem, path
end
@@ -179,7 +179,7 @@ class Formulary
elsif name_or_path.include? "/"
# If name was a path or mapped to a cached formula
f = FromPathLoader.new(name_or_path)
- elsif name_or_path =~ /\.rb$/
+ elsif File.extname(name_or_path) == ".rb"
f = FromPathLoader.new(File.expand_path(name_or_path))
else
f = StandardLoader.new(name_or_path)