Class: Lindo::Browser
- Inherits:
-
Object
- Object
- Lindo::Browser
- Defined in:
- lib/lindo/browser.rb
Class Method Summary collapse
- .gnome? ⇒ Boolean
- .host ⇒ Object
- .kde? ⇒ Boolean
- .linux? ⇒ Boolean
- .macos? ⇒ Boolean
- .open(url) ⇒ Object
- .windows? ⇒ Boolean
Class Method Details
.gnome? ⇒ Boolean
34 35 36 |
# File 'lib/lindo/browser.rb', line 34 def gnome? Kernel.system("which gnome-open") end |
.host ⇒ Object
21 22 23 24 |
# File 'lib/lindo/browser.rb', line 21 def host require 'rbconfig' Config::CONFIG['host'] end |
.kde? ⇒ Boolean
38 39 40 |
# File 'lib/lindo/browser.rb', line 38 def kde? Kernel.system("which kfmclient") end |
.linux? ⇒ Boolean
42 43 44 |
# File 'lib/lindo/browser.rb', line 42 def linux? host.include?('linux') end |
.macos? ⇒ Boolean
26 27 28 |
# File 'lib/lindo/browser.rb', line 26 def macos? host.include?('darwin') end |
.open(url) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/lindo/browser.rb', line 5 def open(url) if macos? `/usr/bin/open #{url}` elsif windows? `'C:\Program Files\Internet Explorer\IEXPLORE.EXE' #{url}` elsif gnome? `gnome-open #{url}` elsif kde? `kfmclient openURL #{url}` elsif linux? `firefox #{url}` #not the default browser. else raise "Unrecognized OS. Browser can't be found." end end |
.windows? ⇒ Boolean
30 31 32 |
# File 'lib/lindo/browser.rb', line 30 def windows? host.include?('mswin') end |