Module: Browser

Extended by:
OS
Included in:
Booker
Defined in:
lib/browser.rb

Overview

return browser (chrome) opening command

Instance Method Summary collapse

Methods included from OS

linux?, mac?, windows?

Instance Method Details

#browseObject



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

#domainObject



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

#searchObject



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