Module: Sanitizer

Included in:
Brocli::Initiate
Defined in:
lib/brocli/sanitizer.rb

Instance Method Summary collapse

Instance Method Details

#sanitizer(url) ⇒ Object

check for the scheme of url passed and append a scheme if not present since httparty requires scheme as well



4
5
6
7
8
9
10
11
# File 'lib/brocli/sanitizer.rb', line 4

def sanitizer(url)
  uri = URI.parse(url)
  if not uri.scheme
    link = "https://#{url}"
    uri = URI(link)
  end
  uri
end