Method: HookApp#bookmark_for
- Defined in:
- lib/hook/hookapp.rb
#bookmark_for(url) ⇒ Object
Get a Hook bookmark for file or URL. Return bookmark hash.
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/hook/hookapp.rb', line 34 def bookmark_for(url) url.valid_hook! raise "Invalid target: #{url}" unless url begin mark = `osascript <<'APPLESCRIPT' tell application "#{HOOK_APP}" set _hook to make bookmark with data "#{url}" if _hook is missing value return "" else return name of _hook & "||" & address of _hook & "||" & path of _hook end if end tell APPLESCRIPT`.strip rescue p => e raise e end raise "Error getting bookmark for #{url}" if mark.empty? mark.split_hook end |