Module: FilePath::PathResolution

Included in:
FilePath
Defined in:
lib/filepath/filepath.rb

Instance Method Summary collapse

Instance Method Details

#absolute_path(base_dir = Dir.pwd) ⇒ Object

FIXME: rename to #absolute?



687
688
689
690
691
692
693
# File 'lib/filepath/filepath.rb', line 687

def absolute_path(base_dir = Dir.pwd) # FIXME: rename to `#absolute`?
  if self.absolute?
    return self
  end

  return base_dir.as_path / self
end

#real_path(base_dir = Dir.pwd) ⇒ Object Also known as: realpath



695
696
697
698
699
# File 'lib/filepath/filepath.rb', line 695

def real_path(base_dir = Dir.pwd)
  path = absolute_path(base_dir)

  return path.resolve_link
end


703
704
705
# File 'lib/filepath/filepath.rb', line 703

def resolve_link
  return File.readlink(self).as_path
end