module Keynote::Util

Public Instance Methods

eval_script(script) click to toggle source
# File lib/keynote/util.rb, line 7
def eval_script(script)
  file = Tempfile.new(['osascript', '.js'])
  file.write(script)
  file.close
  command = "osascript -l JavaScript #{file.path}"
  execute_out, process_status = *Open3.capture2(command)
  execute_out.chomp!
  JSON.parse(execute_out) unless execute_out.empty?
ensure
  file.delete
end