Sha256: b01d132f297962621073dbe18feca3798ff1c166f7578f15165f4142fa160ac6

Contents?: true

Size: 547 Bytes

Versions: 1

Compression:

Stored size: 547 Bytes

Contents

# encoding: utf-8

class File
  # determine whether a String path is absolute.
  # @example
  #   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
  # @param [String] - a pathname
  # @return [Boolean]
  def self.absolute_path?(path)
    false | File.dirname(path)[/\A([A-Z]:)?#{Regexp.escape(File::SEPARATOR)}/i]
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cliver-0.2.1 lib/core_ext/file.rb