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
- #has_matching_checksums? ⇒ Boolean
- #has_matching_nokogiri_checksums? ⇒ Boolean
- #valid?(datastream = nil) ⇒ Boolean
Instance Attribute Details
#datastream ⇒ Object
Returns the value of attribute datastream.
3 4 5 |
# File 'lib/fedora_migrate/datastream_verification.rb', line 3 def datastream @datastream end |
Instance Method Details
#has_matching_checksums? ⇒ Boolean
10 11 12 |
# File 'lib/fedora_migrate/datastream_verification.rb', line 10 def has_matching_checksums? datastream.checksum == target_checksum || checksum(datastream.content) == target_checksum end |
#has_matching_nokogiri_checksums? ⇒ Boolean
14 15 16 17 |
# File 'lib/fedora_migrate/datastream_verification.rb', line 14 def has_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
5 6 7 8 |
# File 'lib/fedora_migrate/datastream_verification.rb', line 5 def valid? datastream=nil @datastream = datastream || @source has_matching_checksums? || has_matching_nokogiri_checksums? end |