Sha256: bb1eeed79b17cde887dd114ca3b47317a53963c99a676d520d1e04913e9fcbe9
Contents?: true
Size: 756 Bytes
Versions: 4
Compression:
Stored size: 756 Bytes
Contents
module Waddup module Extension::AppleScript include Waddup::Extension::System # Runs given AppleScript on disk # # Options: # # :args (arguments to provide to the script) # :as_ruby (whether to eval results as Ruby) # def applescript(script, options = {}) args = options.delete(:args) || [] arguments = args.map { |arg| " '#{arg}'" }.join results = run("osascript -s s '#{script}'#{arguments}") # TODO: This is very scary, find alternatives! eval "[#{results[1...-1]}]" if options.delete(:as_ruby) end # Whether AppleScript is available def applescript? osx? && begin run('osalang', quietly: true).include? 'AppleScript' end end end end
Version data entries
4 entries across 4 versions & 1 rubygems