Linux server1.dn-server.com 4.18.0-553.89.1.lve.el8.x86_64 #1 SMP Wed Dec 10 13:58:50 UTC 2025 x86_64
LiteSpeed
Server IP : 195.201.204.189 & Your IP : 216.73.216.37
Domains :
Cant Read [ /etc/named.conf ]
User : beriska1
Terminal
Auto Root
Create File
Create Folder
Localroot Suggester
Backdoor Destroyer
Readme
/
opt /
alt /
ruby19 /
share /
ri /
1.9.1 /
system /
Tempfile /
Delete
Unzip
Name
Size
Permission
Date
Action
Remover
[ DIR ]
drwxr-xr-x
2026-05-01 04:24
cdesc-Tempfile.ri
3.63
KB
-rw-r--r--
2023-07-26 17:26
close%21-i.ri
282
B
-rw-r--r--
2023-07-26 17:26
close-i.ri
543
B
-rw-r--r--
2023-07-26 17:26
delete-i.ri
148
B
-rw-r--r--
2023-07-26 17:26
length-i.ri
148
B
-rw-r--r--
2023-07-26 17:26
new-c.ri
2.29
KB
-rw-r--r--
2023-07-26 17:26
open-c.ri
974
B
-rw-r--r--
2023-07-26 17:26
open-i.ri
223
B
-rw-r--r--
2023-07-26 17:26
path-i.ri
282
B
-rw-r--r--
2023-07-26 17:26
size-i.ri
326
B
-rw-r--r--
2023-07-26 17:26
unlink-i.ri
1.64
KB
-rw-r--r--
2023-07-26 17:26
Save
Rename
U:RDoc::NormalClass[iI" Tempfile:EF@I"DelegateClass(File);Fo:RDoc::Markup::Document:@parts[o;;[ o:RDoc::Markup::Paragraph;[I"MA utility class for managing temporary files. When you create a Tempfile;TI"Oobject, it will create a temporary file with a unique filename. A Tempfile;TI"Oobjects behaves just like a File object, and you can perform all the usual;TI"Qfile operations on it: reading data, writing data, changing its permissions,;TI"Retc. So although this class does not explicitly document all instance methods;TI"Jsupported by File, you can in fact call any File instance method on a;TI"Tempfile object.;To:RDoc::Markup::BlankLine S:RDoc::Markup::Heading: leveli: textI" Synopsis;T@o:RDoc::Markup::Verbatim;[I"require 'tempfile' ;FI" ;FI" file = Tempfile.new('foo') ;FI"Gfile.path # => A unique filename in the OS's temp directory, ;FI"2 # e.g.: "/tmp/foo.24722.0" ;FI"G # This filename contains 'foo' in its basename. ;FI"file.write("hello world") ;FI"file.rewind ;FI"'file.read # => "hello world" ;FI"file.close ;FI",file.unlink # deletes the temp file ;FS;;i; I"Good practices;T@S;;i; I"Explicit close;T@o; ;[I"NWhen a Tempfile object is garbage collected, or when the Ruby interpreter;TI"Nexits, its associated temporary file is automatically deleted. This means;TI"Nthat's it's unnecessary to explicitly delete a Tempfile after use, though;TI"Nit's good practice to do so: not explicitly deleting unused Tempfiles can;TI"Jpotentially leave behind large amounts of tempfiles on the filesystem;TI"Puntil they're garbage collected. The existence of these temp files can make;TI"4it harder to determine a new Tempfile filename.;T@o; ;[I"PTherefore, one should always call #unlink or close in an ensure block, like;TI" this:;T@o;;[I" file = Tempfile.new('foo') ;FI"begin ;FI"% ...do something with file... ;FI"ensure ;FI" file.close ;FI". file.unlink # deletes the temp file ;FI" end ;FS;;i; I"Unlink after creation;T@o; ;[I"NOn POSIX systems, it's possible to unlink a file right after creating it,;TI"Mand before closing it. This removes the filesystem entry without closing;TI"Lthe file handle, so it ensures that only the processes that already had;TI"Gthe file handle open can access the file's contents. It's strongly;TI"Krecommended that you do this if you do not want any other processes to;TI"Jbe able to read from or write to the Tempfile, and you do not need to;TI")know the Tempfile's filename either.;T@o; ;[ I"OFor example, a practical use case for unlink-after-creation would be this:;TI"Myou need a large byte buffer that's too large to comfortably fit in RAM,;TI"Ne.g. when you're writing a web server and you want to buffer the client's;TI"file upload data.;T@o; ;[I"EPlease refer to #unlink for more information and a code example.;T@S;;i; I"Minor notes;T@o; ;[I"STempfile's filename picking method is both thread-safe and inter-process-safe:;TI"Rit guarantees that no other threads or processes will pick the same filename.;T@o; ;[I"OTempfile itself however may not be entirely thread-safe. If you access the;TI"Qsame Tempfile object from multiple threads then you should protect it with a;TI"mutex.;T: @fileI"lib/tempfile.rb;T;0[ [[I"MAX_TRY;Fo;;[ ;0@_[ [[I" class;F[[:public[[I"new;F@_[I" open;F@_[:protected[ [:private[ [I" instance;F[[;[ [I" close;F@_[I"close!;F@_[I"delete;F@_[I"length;F@_[I" open;F@_[I" path;F@_[I" size;F@_[I"unlink;F@_[;[ [;[