Module: Browser
Overview
return browser (chrome) opening command
Instance Method Summary collapse
- #browse ⇒ Object
- #domain ⇒ Object
-
#prep(url) ⇒ Object
helper methods.
- #wrap(url) ⇒ Object
Methods included from OS
Instance Method Details
#browse ⇒ Object
23 24 25 26 27 28 29 30 31 32 |
# File 'lib/config.rb', line 23 def browse if OS.windows? # alternatively, start seems to work - probably check if powershell v cygwin? '/cygdrive/c/Program\ Files\ \(x86\)/Google/Chrome/Application/chrome.exe ' elsif OS.mac? 'open -a "Google Chrome" ' elsif OS.linux? 'xdg-open ' # completely guessing here end end |
#domain ⇒ Object
34 35 36 |
# File 'lib/config.rb', line 34 def domain /.*(io|com|web|net|org|gov|edu|xyz)(\/.*)?$/i end |
#prep(url) ⇒ Object
helper methods
39 40 41 42 43 44 45 |
# File 'lib/config.rb', line 39 def prep(url) if /^http/.match(url) url else 'http://' + url end end |
#wrap(url) ⇒ Object
47 48 49 50 |
# File 'lib/config.rb', line 47 def wrap(url) #"'" + url + "'" url end |