Class: UtilityBelt::WebBrowser

Inherits:
Object
  • Object
show all
Defined in:
lib/utility_belt/webbrowser.rb

Class Method Summary collapse

Class Method Details

.open(url) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/utility_belt/webbrowser.rb', line 5

def self.open(url)
  case Platform::IMPL
    when :macosx
      Kernel.system("open #{url}")
    when :mswin
      Kernel.system("start #{url}")
    when :linux
      #figure out the prefered web browser
      #debian
      if b = File.readlink("/etc/alternatives/x-www-browser") rescue false
        launch_linux_browser(b, url)
      #gentoo maybe
      elsif b = ENV["BROWSER"]
        launch_linux_browser(b, url)
      end
    end
end