Module: Browser
Overview
return browser (chrome) opening command
Instance Method Summary collapse
- #browse ⇒ Object
- #domain ⇒ Object
-
#prep(url) ⇒ Object
helper methods.
- #search ⇒ Object
- #wrap(url) ⇒ Object
Methods included from OS
Instance Method Details
#browse ⇒ Object
22 23 24 25 26 27 28 29 30 |
# File 'lib/browser.rb', line 22 def browse if OS.windows? '/cygdrive/c/Program\ Files\ \(x86\)/Google/Chrome/Application/chrome.exe ' elsif OS.mac? 'open -a "Google Chrome" ' elsif OS.linix? 'xdg-open ' # completely guessing here end end |
#domain ⇒ Object
32 33 34 |
# File 'lib/browser.rb', line 32 def domain /.*(io|com|web|net|org|gov|edu)$/i end |
#prep(url) ⇒ Object
helper methods
44 45 46 47 48 49 50 |
# File 'lib/browser.rb', line 44 def prep(url) if /^http/.match(url) url else 'http://' << url end end |
#search ⇒ Object
36 37 38 39 40 |
# File 'lib/browser.rb', line 36 def search #"https://www.google.com/search?q=" #"http://www.bing.com/search?q=" #lol "https://duckduckgo.com/?q=" end |
#wrap(url) ⇒ Object
52 53 54 |
# File 'lib/browser.rb', line 52 def wrap(url) "'" + url + "'" end |