Class: ActiveFedora::Checksum

Inherits:
Object
  • Object
show all
Defined in:
lib/active_fedora/checksum.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(file) ⇒ Checksum

Returns a new instance of Checksum.



5
6
7
8
9
10
# File 'lib/active_fedora/checksum.rb', line 5

def initialize(file)
  @uri = file.digest.first
  return unless @uri
  @algorithm, @value = @uri.path.split(":")
  @algorithm.upcase!
end

Instance Attribute Details

#algorithmObject (readonly)

Returns the value of attribute algorithm.



3
4
5
# File 'lib/active_fedora/checksum.rb', line 3

def algorithm
  @algorithm
end

#uriObject (readonly)

Returns the value of attribute uri.



3
4
5
# File 'lib/active_fedora/checksum.rb', line 3

def uri
  @uri
end

#valueObject (readonly)

Returns the value of attribute value.



3
4
5
# File 'lib/active_fedora/checksum.rb', line 3

def value
  @value
end