diff options
Diffstat (limited to 'Library/Homebrew/extend')
| -rw-r--r-- | Library/Homebrew/extend/pathname.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/Library/Homebrew/extend/pathname.rb b/Library/Homebrew/extend/pathname.rb index 907679f99..5edd8b664 100644 --- a/Library/Homebrew/extend/pathname.rb +++ b/Library/Homebrew/extend/pathname.rb @@ -301,6 +301,13 @@ class Pathname require 'digest/sha2' incremental_hash(Digest::SHA2) end + alias_method :sha256, :sha2 + + def verify_checksum expected + raise ChecksumMissingError if expected.nil? or expected.empty? + actual = Checksum.new(expected.hash_type, send(expected.hash_type).downcase) + raise ChecksumMismatchError.new(expected, actual) unless expected == actual + end if '1.9' <= RUBY_VERSION alias_method :to_str, :to_s |
