class Ddr::Models::FileCharacterization

Public Class Methods

call(obj) click to toggle source
# File lib/ddr/models/file_characterization.rb, line 9
def self.call(obj)
  new(obj).call
end

Public Instance Methods

call() click to toggle source
# File lib/ddr/models/file_characterization.rb, line 13
def call
  with_content_file do |path|
    fits_output = run_fits(path)
    reload
    fits.content = fits_output
    save!
  end
end

Private Instance Methods

fits_command() click to toggle source
# File lib/ddr/models/file_characterization.rb, line 32
def fits_command
  ::File.join(Ddr::Models.fits_home, 'fits.sh')
end
run_fits(path) click to toggle source
# File lib/ddr/models/file_characterization.rb, line 24
def run_fits(path)
  output = `#{fits_command} -i #{Shellwords.escape(path)}`
  unless $?.success?
    raise FITSError, output
  end
  output
end