U:RDoc::AnyMethod[iI"new:ETI"Tempfile::new;TT: publico:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"ICreates a temporary file with permissions 0600 (= only readable and ;TI"8writable by the owner) and opens it with mode "w+".;To:RDoc::Markup::BlankLineo; ; [ I"CThe +basename+ parameter is used to determine the name of the ;TI"Ctemporary file. You can either pass a String or an Array with ;TI"F2 String elements. In the former form, the temporary file's base ;TI"@name will begin with the given string. In the latter form, ;TI"Fthe temporary file's base name will begin with the array's first ;TI";element, and end with the second element. For example:;T@o:RDoc::Markup::Verbatim; [ I""file = Tempfile.new('hello') ;TI"Gfile.path # => something like: "/tmp/hello2843-8392-92849382--0" ;TI" ;TI"C# Use the Array form to enforce an extension in the filename: ;TI",file = Tempfile.new(['hello', '.jpg']) ;TI"Kfile.path # => something like: "/tmp/hello2843-8392-92849382--0.jpg" ;T: @format0o; ; [ I"EThe temporary file will be placed in the directory as specified ;TI"Bby the +tmpdir+ parameter. By default, this is +Dir.tmpdir+. ;TI"?When $SAFE > 0 and the given +tmpdir+ is tainted, it uses ;TI"D'/tmp' as the temporary directory. Please note that ENV values ;TI"Care tainted by default, and +Dir.tmpdir+'s return value might ;TI"=come from environment variables (e.g. $TMPDIR).;T@o; ; [I"2file = Tempfile.new('hello', '/home/aisaka') ;TI"Ofile.path # => something like: "/home/aisaka/hello2843-8392-92849382--0" ;T; 0o; ; [ I"IYou can also pass an options hash. Under the hood, Tempfile creates ;TI"Kthe temporary file using +File.open+. These options will be passed to ;TI"@+File.open+. This is mostly useful for specifying encoding ;TI"options, e.g.:;T@o; ; [ I"FTempfile.new('hello', '/home/aisaka', :encoding => 'ascii-8bit') ;TI" ;TI"1# You can also omit the 'tmpdir' parameter: ;TI"6Tempfile.new('hello', :encoding => 'ascii-8bit') ;T; 0S:RDoc::Markup::Heading: leveli: textI"Exceptions;T@o; ; [I"DIf Tempfile.new cannot find a unique filename within a limited ;TI"6number of tries, then it will raise an exception.;T: @fileI"lib/tempfile.rb;T:0@omit_headings_from_table_of_contents_below0I":new(basename = "", [tmpdir = Dir.tmpdir], [options]) ;T0[I"2(basename="", tmpdir=nil, mode: 0, **options);T@>TI" Tempfile;TcRDoc::NormalClass00