require 'tempfile' module Fontana class TTF2EOT def self.convert(input_string) input_file = create_input_file(input_string) return_string = run_command(input_file) cleanup(input_file) return_string end private def self.cleanup(tempfile) tempfile.unlink end def self.create_input_file(content, filename = 'fontana-ttf2eot-input') tempfile = Tempfile.new([filename, '.ttf']) tempfile.write content tempfile.close tempfile end def self.run_command(input_file) puts "ttf2eot #{input_file.path}" `ttf2eot #{input_file.path}` end end end