Class: Hydra::Works::Characterization::FitsDocument

Inherits:
Object
  • Object
show all
Includes:
OM::XML::Document
Defined in:
lib/hydra/works/characterization/fits_document.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.xml_templateObject



163
164
165
166
167
168
169
170
171
172
173
174
# File 'lib/hydra/works/characterization/fits_document.rb', line 163

def self.xml_template
  builder = Nokogiri::XML::Builder.new do |xml|
    xml.fits(xmlns: 'http://hul.harvard.edu/ois/xml/ns/fits/fits_output',
             'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance',
             'xsi:schemaLocation' => "http://hul.harvard.edu/ois/xml/ns/fits/fits_output
             http://hul.harvard.edu/ois/xml/xsd/fits/fits_output.xsd",
             version: '0.6.0', timestamp: '1/25/12 11:04 AM') do
      xml.identification { xml.identity(toolname: 'FITS') }
    end
  end
  builder.doc
end

Instance Method Details

#__cleanup__Object

Cleanup phase; ugly name to avoid collisions. The send construct here is required to fix up values because the setters are not defined, but rather applied with method_missing.



152
153
154
155
156
157
158
159
160
161
# File 'lib/hydra/works/characterization/fits_document.rb', line 152

def __cleanup__
  # Sometimes, FITS reports the mimetype attribute as a comma-separated string.
  # All terms are arrays and, in this case, there is only one element, so scan the first.
  if file_mime_type.present? && file_mime_type.first.include?(',')
    send("file_mime_type=", [file_mime_type.first.split(',').first])
  end

  # Add any other scrubbers here; don't return any particular value
  nil
end