Class: Mmi::ContentHash::Sha512
- Defined in:
- lib/mmi/content_hash/sha512.rb
Instance Attribute Summary collapse
-
#hex_digest ⇒ Object
Returns the value of attribute hex_digest.
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(hex_digest) ⇒ Sha512
constructor
A new instance of Sha512.
- #match_file?(file_path) ⇒ Boolean
Constructor Details
#initialize(hex_digest) ⇒ Sha512
Returns a new instance of Sha512.
10 11 12 13 14 |
# File 'lib/mmi/content_hash/sha512.rb', line 10 def initialize(hex_digest) super() self.hex_digest = hex_digest end |
Instance Attribute Details
#hex_digest ⇒ Object
Returns the value of attribute hex_digest.
8 9 10 |
# File 'lib/mmi/content_hash/sha512.rb', line 8 def hex_digest @hex_digest end |
Instance Method Details
#==(other) ⇒ Object
20 21 22 |
# File 'lib/mmi/content_hash/sha512.rb', line 20 def ==(other) self.class == other.class && self.hex_digest == other.hex_digest end |
#match_file?(file_path) ⇒ Boolean
16 17 18 |
# File 'lib/mmi/content_hash/sha512.rb', line 16 def match_file?(file_path) Digest::SHA512.hexdigest(File.read(file_path)) == self.hex_digest end |