Module: Hydra::Derivatives::ExtractMetadata

Defined in:
lib/hydra/derivatives/extract_metadata.rb

Instance Method Summary collapse

Instance Method Details

#extract_metadataObject



6
7
8
9
10
11
# File 'lib/hydra/derivatives/extract_metadata.rb', line 6

def 
  return unless has_content?
  Hydra::FileCharacterization.characterize(content, filename_for_characterization.join(""), :fits) do |config|
    config[:fits] = Hydra::Derivatives.fits_path
  end
end

#to_tempfile(&block) ⇒ Object

Restored method. It was required by other creatures



14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/hydra/derivatives/extract_metadata.rb', line 14

def to_tempfile(&block)
  return unless has_content?
  Tempfile.open(filename_for_characterization) do |f|
    f.binmode
    if content.respond_to? :read
      f.write(content.read)
    else
      f.write(content)
    end
    content.rewind if content.respond_to? :rewind
    f.rewind
    yield(f)
  end
end