Sha256: 1b578e0db08a2d8c2c38491e67ff25054a10b1bc310f60a90f34808c7927b1dd
Contents?: true
Size: 604 Bytes
Versions: 49
Compression:
Stored size: 604 Bytes
Contents
require 'pathname' class String # Assuming the string is a file or path name, convert it into an # absolute path. def to_absolute_path # Pathname is incompatible with Windows, but Windows doesn't have # real symlinks so File.expand_path is safe. if RUBY_PLATFORM =~ /(:?mswin|mingw)/ File.expand_path( self ) # Otherwise use Pathname#realpath which respects symlinks. else begin File.expand_path( Pathname.new( self ).realpath.to_s ) rescue Errno::ENOENT File.expand_path( Pathname.new( self ).cleanpath.to_s ) end end end end
Version data entries
49 entries across 49 versions & 7 rubygems