pathmap (String)

         # File lib/rake.rb, line 198
    198:     def pathmap(spec=nil, &block)
    199:       return self if spec.nil?
    200:       result = ''
    201:       spec.scan(/%\{[^}]*\}-?\d*[sdpfnxX%]|%-?\d+d|%.|[^%]+/) do |frag|
    202:         case frag
    203:         when '%f'
    204:           result << File.basename(self)
    205:         when '%n'
    206:           result << File.basename(self).ext
    207:         when '%d'
    208:           result << File.dirname(self)
    209:         when '%x'
    210:           result << $1 if self =~ /[^\/](\.[^.]+)$/
    211:         when '%X'
    212:           if self =~ /^(.+[^\/])(\.[^.]+)$/
    213:             result << $1
    214:           else
    215:             result << self
    216:           end
    217:         when '%p'
    218:           result << self
    219:         when '%s'
    220:           result << (File::ALT_SEPARATOR || File::SEPARATOR)
    221:         when '%%'
    222:           result << "%"
    223:         when /%(-?\d+)d/
    224:           result << pathmap_partial($1.to_i)
    225:         when /^%\{([^}]*)\}(\d*[dpfnxX])/
    226:           patterns, operator = $1, $2
    227:           result << pathmap('%' + operator).pathmap_replace(patterns, &block)
    228:         when /^%/
    229:           fail ArgumentError, "Unknown pathmap specifier #{frag} in '#{spec}'"
    230:         else
    231:           result << frag
    232:         end
    233:       end
    234:       result
    235:     end