determine whether a String path is absolute.
Examples:
File.absolute_path?('foo') #=> false File.absolute_path?('/foo') #=> true File.absolute_path?('foo/bar') #=> false File.absolute_path?('/foo/bar') #=> true File.absolute_path?('C:foo/bar') #=> false File.absolute_path?('C:/foo/bar') #=> true
Parameters:
a pathname
Returns:
14 15 16
# File 'lib/core_ext/file.rb', line 14 def self.absolute_path?(path) false | File.dirname(path)[/\A([A-Z]:)?#{Regexp.escape(File::SEPARATOR)}/i] end