Method: TeXMath::Converter#convert

Defined in:
lib/texmath/converter.rb

#convert(data) ⇒ String

Convert data between formats.

Returns:

  • the converted data



47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/texmath/converter.rb', line 47

def convert(data)
  Open3.popen3(command) do |stdin, stdout, stderr| 
    stdin.puts(data)
    stdin.close
    output = stdout.read
    error = stderr.read
    raise ConversionError, error unless error.empty?
    return output.strip
  end
rescue Errno::ENOENT
  raise NoExecutableError, "Can't find the '#{executable}' executable."
end