Module: Hydra::Derivatives::ExtractMetadata
- Includes:
- Open3
- Defined in:
- lib/hydra/derivatives/extract_metadata.rb
Instance Method Summary collapse
Instance Method Details
#extract_metadata ⇒ Object
7 8 9 10 11 12 13 |
# File 'lib/hydra/derivatives/extract_metadata.rb', line 7 def out = nil to_tempfile do |f| out = run_fits!(f.path) end out end |
#to_tempfile {|f| ... } ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/hydra/derivatives/extract_metadata.rb', line 15 def to_tempfile &block return unless has_content? tmp_base = Hydra::Derivatives.temp_file_base f = Tempfile.new("#{pid}-#{dsVersionID}") f.binmode if content.respond_to? :read f.write(content.read) else f.write(content) end f.close content.rewind if content.respond_to? :rewind yield(f) f.unlink end |