7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
# File 'lib/markdownplus/julia.rb', line 7
def execute(input, parameters, variables, warnings, errors)
output = nil
file = Tempfile.new(['julia-script','.jl'])
begin
parameters.each_with_index do |param,i|
if param.respond_to?(:to_julia)
file.write(param.to_julia)
else
warnings << "Parameter [#{i}] does not respond to to_julia"
end
end
file.write(input)
file.close
output = `julia #{file.path}`
output.gsub!(/\n\s+/,"\n")
ensure
end
output
end
|