Module: Ace::Task::Molecules::PathUtils

Defined in:
lib/ace/task/molecules/path_utils.rb

Overview

Shared path utilities for task plan components.

Class Method Summary collapse

Class Method Details

.relative_path(path) ⇒ Object



10
11
12
13
14
15
16
# File 'lib/ace/task/molecules/path_utils.rb', line 10

def relative_path(path)
  absolute = File.expand_path(path)
  cwd = File.expand_path(Dir.pwd)
  return absolute unless absolute.start_with?("#{cwd}/")

  absolute.delete_prefix("#{cwd}/")
end