class String
def pathmap_replace(patterns, &block)
Preform the pathmap replacement operations on the given path. The
def pathmap_replace(patterns, &block) result = self patterns.split(';').each do |pair| pattern, replacement = pair.split(',') pattern = Regexp.new(pattern) if replacement == '*' && block_given? result = result.sub(pattern, &block) elsif replacement result = result.sub(pattern, replacement) else result = result.sub(pattern, '') end end result end