Returns true
if self
points to a mountpoint.
Removes a file or directory, using File.unlink
if self
is a file, or Dir.unlink
as necessary.
This method is called when strong warning is produced by the parser. fmt
and args
is printf style.
Tokenizes the Ruby program and returns an array of strings.
p Ripper.tokenize("def m(a) nil end") # => ["def", " ", "m", "(", "a", ")", " ", "nil", " ", "end"]
Pushes back one character (passed as a parameter) onto strio such that a subsequent buffered read will return it. There is no limitation for multiple pushbacks including pushing back behind the beginning of the buffer string.
Truncates the buffer string to at most integer bytes. The strio must be opened for writing.
Set
the scan pointer to the previous position. Only one previous position is remembered, and it changes with each scanning operation.
s = StringScanner.new('test string') s.scan(/\w+/) # => "test" s.unscan s.scan(/../) # => "te" s.scan(/\d/) # => nil s.unscan # ScanError: unscan failed: previous match record not exist
disconnects OLE server. If this method called, then the WIN32OLE_EVENT
object does not receive the OLE server event any more. This method is trial implementation.
ie = WIN32OLE.new('InternetExplorer.Application') ev = WIN32OLE_EVENT.new(ie) ev.on_event() {...} ... ev.unadvise
Untrust both the object returned by _getobj_ and self.
Untaint both the object returned by _getobj_ and self.
Generate results and print them. (see ERB#result
)
Log an UNKNOWN
message. This will be printed no matter what the logger’s level is.
See info
for more information.
Returns a matrix with entries rounded to the given precision (see Float#round
)
Returns a vector with entries rounded to the given precision (see Float#round
)
Returns the modulus (Pythagorean distance) of the vector.
Vector[5,8,2].r => 9.643650761
Unlinks (deletes) the file from the filesystem. One should always unlink the file after using it, as is explained in the “Explicit close” good practice section in the Tempfile
overview:
file = Tempfile.new('foo') begin # ...do something with file... ensure file.close file.unlink # deletes the temp file end
On POSIX systems it’s possible to unlink a file before closing it. This practice is explained in detail in the Tempfile
overview (section “Unlink after creation”); please refer there for more information.
However, unlink-before-close may not be supported on non-POSIX operating systems. Microsoft Windows is the most notable case: unlinking a non-closed file will result in an error, which this method will silently ignore. If you want to practice unlink-before-close whenever possible, then you should write code like this:
file = Tempfile.new('foo') file.unlink # On Windows this silently fails. begin # ... do something with file ... ensure file.close! # Closes the file handle. If the file wasn't unlinked # because #unlink failed, then this method will attempt # to do so again. end
Returns true
if any thread has terminated and is ready to be collected.
Returns true
if any thread has terminated and is ready to be collected.
Dissociates meth from its current receiver. The resulting UnboundMethod
can subsequently be bound to a new object of the same class (see UnboundMethod
).
Wakes up thr
, making it eligible for scheduling.
a = Thread.new { puts "a"; Thread.stop; puts "c" } sleep 0.1 while a.status!='sleep' puts "Got here" a.run a.join
This will produce:
a Got here c
See also the instance method wakeup
.
Releases the lock. Raises ThreadError
if mutex
wasn’t locked by the current thread.
Obtains a lock, runs the block, and releases the lock when the block completes. See the example under Mutex
.