Ruby interprets paths in a POSIX way, meaning you should use forward slashes when possible.
//server/share
The trailing slash is unnecessary, just like in native Windows. You can use backslashes, but they have to be escaped with another backslash.
\\\\server\\share
I'd only recommend that when you're passing UNC paths from native programs directly and can't transform them. When I'm mixing Ruby/Windows paths, like in a build script that uses Ruby methods and native Windows apps, which each require different paths, I'll use some helpers:
def windows_path(value)
value.gsub '/', '\\'
end
def posix_path(value)
value.gsub '\\', '/'
end
Always enclose your paths in single quotes, if they're literal, or double-quotes if you're interpolating. Forward slashes tell Ruby to start interpreting a regex. This is a common error for me in irb.
irb> File.exists? //server/share
SyntaxError: (irb):2: unknown regexp options - rvr