Module: FedoraMigrate::DatastreamVerification
- Included in:
- ContentMover
- Defined in:
- lib/fedora_migrate/datastream_verification.rb
Instance Attribute Summary collapse
-
#datastream ⇒ Object
Returns the value of attribute datastream.
Instance Method Summary collapse
- #matching_checksums? ⇒ Boolean
- #matching_nokogiri_checksums? ⇒ Boolean
- #valid?(datastream = nil) ⇒ Boolean
Instance Attribute Details
#datastream ⇒ Object
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
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
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
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 |