Module: PathUtils

Defined in:
lib/hash_delegator.rb

Class Method Summary collapse

Class Method Details

.resolve_path_or_substitute(path, expression) ⇒ String

Determines if a given path is absolute or substitutes a

placeholder in an expression with the path.

Parameters:

  • path (String)

    The input path to check or fill in.

  • expression (String)

    The expression where a wildcard ‘*’ is replaced by the path if it’s not absolute.

Returns:

  • (String)

    The absolute path or the expression with the wildcard replaced by the path.



419
420
421
422
423
424
425
# File 'lib/hash_delegator.rb', line 419

def self.resolve_path_or_substitute(path, expression)
  if path.start_with?('/')
    path
  else
    expression.gsub('*', path)
  end
end