# File lib/puppet/util/fileparsing.rb, line 302
302:   def to_line(details)
303:     unless record = record_type(details[:record_type])
304:       raise ArgumentError, "Invalid record type #{details[:record_type].inspect}"
305:     end
306: 
307:     if record.respond_to?(:pre_gen)
308:       details = details.dup
309:       record.send(:pre_gen, details)
310:     end
311: 
312:     case record.type
313:     when :text; return details[:line]
314:     else
315:       return record.to_line(details) if record.respond_to?(:to_line)
316: 
317:       line = record.join(details)
318: 
319:       if regex = record.rts
320:         # If they say true, then use whitespace; else, use their regex.
321:         if regex == true
322:           regex = /\s+$/
323:         end
324:         return line.sub(regex,'')
325:       else
326:         return line
327:       end
328:     end
329:   end