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



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

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 "
  elsif OS.linux?
    "xdg-open "
  end
end

#domainObject



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

def domain
  /.*(io|com|web|net|org|gov|edu|xyz)(\/.*)?$/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