Method: HookApp#link_all

Defined in:
lib/hook/hookapp.rb

Create bi-directional links between every file/url in the list of arguments



455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
# File 'lib/hook/hookapp.rb', line 455

def link_all(args)
  args.each do |file|
    source = file.valid_hook
    link_to = args.dup.map(&:valid_hook).reject { |url| url == source }
    link_to.each do |url|
      `osascript <<'APPLESCRIPT'
        tell application "#{HOOK_APP}"
          set _mark1 to make bookmark with data "#{source}"
          set _mark2 to make bookmark with data "#{url}"
          hook _mark1 and _mark2
          return true
        end tell
      APPLESCRIPT`
    end
  end
  "Linked #{args.length} files to each other"
end