Method: CouchShell::Shell#normalize_server_url
- Defined in:
- lib/couch-shell/shell.rb
#normalize_server_url(url) ⇒ Object
79 80 81 82 83 84 85 86 87 88 89 |
# File 'lib/couch-shell/shell.rb', line 79 def normalize_server_url(url) return nil if url.nil? # remove trailing slash url = url.sub(%r{/\z}, '') # prepend http:// if scheme is omitted if url =~ /\A\p{Alpha}(?:\p{Alpha}|\p{Digit}|\+|\-|\.)*:/ url else "http://#{url}" end end |