Method: HookApp#get_hooks
- Defined in:
- lib/hook/hookapp.rb
#get_hooks(url) ⇒ Object
Get bookmarks hooked to file or URL. Return array of bookmark hashes.
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/hook/hookapp.rb', line 58 def get_hooks(url) url.valid_hook! raise "Invalid target: #{url}" unless url hooks = `osascript <<'APPLESCRIPT' tell application "#{HOOK_APP}" set _mark to make bookmark with data "#{url}" if _mark is missing value return "" end if set _hooks to hooked bookmarks of _mark set _out to {} repeat with _hook in _hooks set _out to _out & (name of _hook & "||" & address of _hook & "||" & path of _hook) end repeat set {astid, AppleScript's text item delimiters} to {AppleScript's text item delimiters, "^^"} set _output to _out as string set AppleScript's text item delimiters to astid return _output end tell APPLESCRIPT`.strip hooks.split_hooks end |