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.
10 11 12 |
# File 'lib/suppository/checksummed.rb', line 10 def initialize(path) @path = File.(path) end |
Instance Attribute Details
#path ⇒ Object (readonly)
Returns the value of attribute path.
8 9 10 |
# File 'lib/suppository/checksummed.rb', line 8 def path @path end |
Instance Method Details
#md5 ⇒ Object
14 15 16 |
# File 'lib/suppository/checksummed.rb', line 14 def md5 @md5 ||= Digest::MD5.file(@path).hexdigest end |
#sha1 ⇒ Object
18 19 20 |
# File 'lib/suppository/checksummed.rb', line 18 def sha1 @sha1 ||= Digest::SHA1.file(@path).hexdigest end |
#sha2 ⇒ Object
22 23 24 |
# File 'lib/suppository/checksummed.rb', line 22 def sha2 @sha2 ||= Digest::SHA2.file(@path).hexdigest end |