525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
|
# File 'lib/rabbit/utils.rb', line 525
def create(options={})
extension = options[:extension]
content = options[:content]
source = options[:source]
if source
extension ||= source.extension
content ||= source.read
end
prefix = ["rabbit", options[:prefix]].compact.join("-") + "-"
if extension
basename = [prefix, ".#{extension}"]
else
basename = prefix
end
temp = Tempfile.new(basename)
if content
temp.binmode
temp.print(content)
temp.close
end
yield temp
end
|