aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/cask/lib/hbc/container/criteria.rb
diff options
context:
space:
mode:
authorMarkus Reiter2017-08-08 18:10:01 +0200
committerMarkus Reiter2017-08-08 18:10:01 +0200
commitb6b8e8863fe70fbdfd0758dd72127de0a96e329f (patch)
tree7650db8d8a223351617ad964eeda38ef614756f7 /Library/Homebrew/cask/lib/hbc/container/criteria.rb
parent93051b27d6886dae6df01544c86df579f21f6410 (diff)
downloadbrew-b6b8e8863fe70fbdfd0758dd72127de0a96e329f.tar.bz2
Simplify SubversionDownloadStrategy.
Diffstat (limited to 'Library/Homebrew/cask/lib/hbc/container/criteria.rb')
-rw-r--r--Library/Homebrew/cask/lib/hbc/container/criteria.rb6
1 files changed, 4 insertions, 2 deletions
diff --git a/Library/Homebrew/cask/lib/hbc/container/criteria.rb b/Library/Homebrew/cask/lib/hbc/container/criteria.rb
index 66ecb8c87..52f171d6a 100644
--- a/Library/Homebrew/cask/lib/hbc/container/criteria.rb
+++ b/Library/Homebrew/cask/lib/hbc/container/criteria.rb
@@ -13,9 +13,11 @@ module Hbc
end
def magic_number(regex)
+ return false if path.directory?
+
# 262: length of the longest regex (currently: Hbc::Container::Tar)
- @magic_number ||= File.open(@path, "rb") { |f| f.read(262) }
- @magic_number =~ regex
+ @magic_number ||= File.open(path, "rb") { |f| f.read(262) }
+ @magic_number.match?(regex)
end
end
end