Class: Suppository::Checksummed

Inherits:
Object
  • Object
show all
Defined in:
lib/suppository/checksummed.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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.expand_path(path)
end

Instance Attribute Details

#pathObject (readonly)

Returns the value of attribute path.



8
9
10
# File 'lib/suppository/checksummed.rb', line 8

def path
  @path
end

Instance Method Details

#md5Object



14
15
16
# File 'lib/suppository/checksummed.rb', line 14

def md5
  @md5 ||= Digest::MD5.file(@path).hexdigest
end

#sha1Object



18
19
20
# File 'lib/suppository/checksummed.rb', line 18

def sha1
  @sha1 ||= Digest::SHA1.file(@path).hexdigest
end

#sha2Object



22
23
24
# File 'lib/suppository/checksummed.rb', line 22

def sha2
  @sha2 ||= Digest::SHA2.file(@path).hexdigest
end