Class: Suppository::Checksummed
- Inherits:
-
Object
- Object
- Suppository::Checksummed
- Defined in:
- lib/suppository/checksummed.rb
Instance Attribute Summary collapse
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
-
#initialize(path) ⇒ Checksummed
constructor
A new instance of Checksummed.
- #md5 ⇒ Object
- #sha1 ⇒ Object
- #sha2 ⇒ Object
Constructor Details
#initialize(path) ⇒ Checksummed
Returns a new instance of Checksummed.
8 9 10 |
# File 'lib/suppository/checksummed.rb', line 8 def initialize(path) @path = File.(path) end |
Instance Attribute Details
#path ⇒ Object (readonly)
Returns the value of attribute path.
6 7 8 |
# File 'lib/suppository/checksummed.rb', line 6 def path @path end |
Instance Method Details
#md5 ⇒ Object
12 13 14 |
# File 'lib/suppository/checksummed.rb', line 12 def md5 @md5 ||= Digest::MD5.file(@path).hexdigest end |
#sha1 ⇒ Object
16 17 18 |
# File 'lib/suppository/checksummed.rb', line 16 def sha1 @sha1 ||= Digest::SHA1.file(@path).hexdigest end |
#sha2 ⇒ Object
20 21 22 |
# File 'lib/suppository/checksummed.rb', line 20 def sha2 @sha2 ||= Digest::SHA2.file(@path).hexdigest end |