class Asciidoctor::PathResolver

def expand_path path

The result will be relative if the path is relative and absolute if the path is absolute.
returns a String path as a posix path with parent references resolved and self references removed.

path - the String path to expand

references (..), and removing self references (.).
Public: Expand the specified path by converting the path to a posix path, resolving parent
def expand_path path
  path_segments, path_root = partition_path path
  if path.include? DOT_DOT
    resolved_segments = []
    path_segments.each do |segment|
      segment == DOT_DOT ? resolved_segments.pop : resolved_segments << segment
    end
    join_path resolved_segments, path_root
  else
    join_path path_segments, path_root
  end
end