Module UrlConvert
In: util/urlconvert.rb

Convert URLS to and from paths.

Methods
path2url    url2path   
Public Instance methods
url2path(s, proto = "\\w+")

Convert a URL to a path.

s
string holding URL
proto
string (converted to Regexp) to match protocol to convert.
# File util/urlconvert.rb, line 51
def url2path(s, proto = "\\w+")
  Regexp.new("^(#{proto}://)(.*)$") =~ s ? $2 : s
end
path2url(s, proto = "file")

Convert path to URL.

s
string holding path
proto
protocol to use for generated URL (defaults to "file")
# File util/urlconvert.rb, line 60
def path2url(s, proto = "file")
  s = File.expand_path(s) if proto == "file"; proto + "://" + s
end