File tree 1 file changed +4
-7
lines changed
1 file changed +4
-7
lines changed Original file line number Diff line number Diff line change 230
230
231
231
# :stopdoc:
232
232
233
- TMPFILE = ["rdtmp", $$, 0]
234
-
235
233
MARK_TO_LEVEL = {
236
234
'=' => 1,
237
235
'==' => 2,
@@ -360,11 +358,10 @@ def next_token # :nodoc:
360
358
if @tree.filter[@in_part].mode == :rd # if output is RD formatted
361
359
subtree = parse_subtree(part_out.to_a)
362
360
else # if output is target formatted
363
- basename = TMPFILE.join('.')
364
- TMPFILE[-1] += 1
365
- tmpfile = open(@tree.tmp_dir + "/" + basename + ".#{@in_part}", "w")
366
- tmpfile.print(part_out)
367
- tmpfile.close
361
+ basename = Tempfile.create(["rdtmp", ".#{@in_part}"], @tree.tmp_dir) do |tmpfile|
362
+ tmpfile.print(part_out)
363
+ File.basename(tmpfile.path)
364
+ end
368
365
subtree = parse_subtree(["=begin\n", "<<< #{basename}\n", "=end\n"])
369
366
end
370
367
@in_part = nil
You can’t perform that action at this time.
0 commit comments