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
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

#domainObject



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