Module: Keynote::Util
Instance Method Summary collapse
Instance Method Details
#eval_script(script) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 |
# 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 |