Class: Launchy::Application::General

Inherits:
Launchy::Application
  • Object
show all
Defined in:
lib/my_shows/launcher.rb

Overview

The class handling the browser application and all of its schemes

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.handles?(uri) ⇒ Boolean

Returns:

  • (Boolean)


8
9
10
# File 'lib/my_shows/launcher.rb', line 8

def self.handles?(uri)
  true
end

Instance Method Details

#app_listObject

use a call back mechanism to get the right app_list that is decided by the host_os_family class.



30
31
32
# File 'lib/my_shows/launcher.rb', line 30

def app_list
  host_os_family.app_list(self)
end

#cmdObject

Raises:

  • (Launchy::CommandNotFoundError)


34
35
36
37
38
39
40
41
42
43
44
# File 'lib/my_shows/launcher.rb', line 34

def cmd
  possibilities = app_list.flatten
  possibilities.each do |p|
    Launchy.log "#{self.class.name} : possibility : #{p}"
  end
  if (cmdline = possibilities.shift)
    Launchy.log "#{self.class.name} : Using browser value '#{cmdline}'"
    return cmdline
  end
  raise Launchy::CommandNotFoundError, "Unable to find a browser command. If this is unexpected, #{Launchy.bug_report_message}"
end

#cygwin_app_listObject



16
17
18
# File 'lib/my_shows/launcher.rb', line 16

def cygwin_app_list
  ['cmd /C start /b']
end

#darwin_app_listObject



20
21
22
# File 'lib/my_shows/launcher.rb', line 20

def darwin_app_list
  [find_executable("open")]
end

#nix_app_listObject



24
25
26
# File 'lib/my_shows/launcher.rb', line 24

def nix_app_list
  %w[ xdg-open ]
end

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



47
48
49
# File 'lib/my_shows/launcher.rb', line 47

def open(uri, options = {})
  run(cmd, uri)
end

#windows_app_listObject



12
13
14
# File 'lib/my_shows/launcher.rb', line 12

def windows_app_list
  ['start /b']
end