Class: CalendarAssistant::ZoomLaunchy

Inherits:
Launchy::Application::Browser
  • Object
show all
Defined in:
lib/calendar_assistant/extensions/launchy_extensions.rb

Constant Summary collapse

ZOOM_URI_REGEXP =
%r(https?://\w+.zoom.us/j/(\d+)(\?(.*))?)

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.handles?(uri) ⇒ Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/calendar_assistant/extensions/launchy_extensions.rb', line 17

def self.handles?(uri)
  return true if ZOOM_URI_REGEXP.match(uri)
end

Instance Method Details

#darwin_app_listObject



21
22
23
# File 'lib/calendar_assistant/extensions/launchy_extensions.rb', line 21

def darwin_app_list
  [find_executable("open")]
end

#nix_app_listObject



25
26
27
# File 'lib/calendar_assistant/extensions/launchy_extensions.rb', line 25

def nix_app_list
  [find_executable("xdg-open")]
end

#open(uri, options = {}) ⇒ Object



29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/calendar_assistant/extensions/launchy_extensions.rb', line 29

def open(uri, options = {})
  command = host_os_family.app_list(self).compact.first
  if command.nil?
    super uri, options
  else
    matches = ZOOM_URI_REGEXP.match(uri)
    confno = matches[1]
    params = matches[3]
    url = "zoommtg://zoom.us/join?confno=#{confno}"
    url += "&#{params}" if params
    run command, [url]
  end
end