Module: Browser

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

Overview

return browser (chrome) opening command

Instance Method Summary collapse

Methods included from OS

linux?, mac?, windows?

Instance Method Details

#browseObject



23
24
25
26
27
28
29
30
31
# File 'lib/config.rb', line 23

def browse
  if OS.windows?
    '/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

#domainObject



33
34
35
# File 'lib/config.rb', line 33

def domain
  /.*(io|com|web|net|org|gov|edu)$/i
end

#prep(url) ⇒ Object

helper methods



38
39
40
41
42
43
44
# File 'lib/config.rb', line 38

def prep(url)
  if /^http/.match(url)
    url
  else
    'http://' << url
  end
end

#wrap(url) ⇒ Object



46
47
48
# File 'lib/config.rb', line 46

def wrap(url)
  "'" + url + "'"
end