Class: Vagrant::Smartos::Zones::Util::Checksum

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant/smartos/zones/util/checksum.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path, checksum) ⇒ Checksum

Returns a new instance of Checksum.



10
11
12
13
# File 'lib/vagrant/smartos/zones/util/checksum.rb', line 10

def initialize(path, checksum)
  @path = path
  @checksum = checksum
end

Instance Attribute Details

#checksumObject (readonly)

Returns the value of attribute checksum.



8
9
10
# File 'lib/vagrant/smartos/zones/util/checksum.rb', line 8

def checksum
  @checksum
end

#pathObject (readonly)

Returns the value of attribute path.



8
9
10
# File 'lib/vagrant/smartos/zones/util/checksum.rb', line 8

def path
  @path
end

Instance Method Details

#valid?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/vagrant/smartos/zones/util/checksum.rb', line 15

def valid?
  Digest::MD5.file(path) == checksum
end