Module: FedoraMigrate::DatastreamVerification

Included in:
ContentMover
Defined in:
lib/fedora_migrate/datastream_verification.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#datastreamObject

Returns the value of attribute datastream.



2
3
4
# File 'lib/fedora_migrate/datastream_verification.rb', line 2

def datastream
  @datastream
end

Instance Method Details

#matching_checksums?Boolean

Returns:

  • (Boolean)


9
10
11
# File 'lib/fedora_migrate/datastream_verification.rb', line 9

def matching_checksums?
  datastream.checksum == target_checksum || checksum(datastream.content) == target_checksum
end

#matching_nokogiri_checksums?Boolean

Returns:

  • (Boolean)


13
14
15
16
# File 'lib/fedora_migrate/datastream_verification.rb', line 13

def matching_nokogiri_checksums?
  return false unless datastream.mimeType == "text/xml"
  checksum(Nokogiri::XML(datastream.content).to_xml) == checksum(Nokogiri::XML(target_content).to_xml)
end

#valid?(datastream = nil) ⇒ Boolean

Returns:

  • (Boolean)


4
5
6
7
# File 'lib/fedora_migrate/datastream_verification.rb', line 4

def valid?(datastream = nil)
  @datastream = datastream || @source
  matching_checksums? || matching_nokogiri_checksums?
end