Sha256: 8a5d0e7e9fa0f589d5909b3b56b430b6439656e9ff274f88b0d34b15ddae2b36
Contents?: true
Size: 754 Bytes
Versions: 1
Compression:
Stored size: 754 Bytes
Contents
module Waddup module Extension::AppleScript include Waddup::Extension::System # Runs given AppleScript # # 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 -e '#{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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
waddup-0.0.2 | lib/waddup/extensions/applescript.rb |