Linux heracles.o2switch.net 4.18.0-553.62.1.lve.el8.x86_64 #1 SMP Mon Jul 21 17:50:35 UTC 2025 x86_64
/
opt
/
alt
/
ruby27
/
share
/
ri
/
system
/
Tempfile
/
//opt/alt/ruby27/share/ri/system/Tempfile/new-c.ri
U:RDoc::AnyMethod[iI"new:ETI"Tempfile::new;TT:privateo: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::BlankLine o; ; [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"Aby the +tmpdir+ parameter. By default, this is +Dir.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"CTempfile.new('hello', '/home/aisaka', encoding: 'ascii-8bit') ;TI" ;TI"1# You can also omit the 'tmpdir' parameter: ;TI"3Tempfile.new('hello', encoding: 'ascii-8bit') ;T; 0o; ; [I"INote: +mode+ keyword argument, as accepted by Tempfile, can only be ;TI"Bnumeric, combination of the modes defined in File::Constants.;T@S: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_below000[ I"2(basename="", tmpdir=nil, mode: 0, **options);T@>TI" Tempfile;TcRDoc::NormalClass00