Returns true
if the named file exists and has a zero size.
file_name can be an IO
object.
Is uri
the URI
for the current local server?
Calculates the error function of x
.
Domain: (-INFINITY, INFINITY)
Codomain: (-1, 1)
Math.erf(0) #=> 0.0
Calculates the complementary error function of x.
Domain: (-INFINITY, INFINITY)
Codomain: (0, 2)
Math.erfc(0) #=> 1.0
Set
the changed state of this object. Notifications will be sent only if the changed state
is true
.
state
Boolean indicating the changed state of this Observable
.
Returns true if this object’s state has been changed since the last notify_observers
call.
URI::regexp([match_schemes])
match_schemes
Array of schemes. If given, resulting regexp matches to URIs whose scheme is one of the match_schemes.
Returns a Regexp
object which matches to URI-like strings. The Regexp
object returned by this method includes arbitrary number of capture group (parentheses). Never rely on it’s number.
require 'uri' # extract first URI from html_string html_string.slice(URI.regexp) # remove ftp URIs html_string.sub(URI.regexp(['ftp']) # You should not rely on the number of parentheses html_string.scan(URI.regexp) do |*matches| p $& end
Allows setting the gem path searcher. This method is available when requiring ‘rubygems/test_case’
Raises a TypeError
to prevent cloning.
By default calls instance(). Override to retain singleton state.
Returns the result of converting the serialized data in source into a Ruby object (possibly with associated subordinate objects). source may be either an instance of IO
or an object that responds to to_str. If proc is specified, each object will be passed to the proc, as the object is being deserialized.
Never pass untrusted data (including user supplied input) to this method. Please see the overview for further details.
Returns the process group ID for this process. Not available on all platforms.
Process.getpgid(0) #=> 25527 Process.getpgrp #=> 25527
Returns the process group ID for the given process id. Not available on all platforms.
Process.getpgid(Process.ppid()) #=> 25527
Returns the session ID for the given process id. If not given, return current process sid. Not available on all platforms.
Process.getsid() #=> 27422 Process.getsid(0) #=> 27422 Process.getsid(Process.pid()) #=> 27422
Gets the scheduling priority for specified process, process group, or user. kind indicates the kind of entity to find: one of Process::PRIO_PGRP
, Process::PRIO_USER
, or Process::PRIO_PROCESS
. integer is an id indicating the particular process, process group, or user (an id of 0 means current). Lower priorities are more favorable for scheduling. Not available on all platforms.
Process.getpriority(Process::PRIO_USER, 0) #=> 19 Process.getpriority(Process::PRIO_PROCESS, 0) #=> 19
Gets the resource limit of the process. cur_limit means current (soft) limit and max_limit means maximum (hard) limit.
resource indicates the kind of resource to limit. It is specified as a symbol such as :CORE
, a string such as "CORE"
or a constant such as Process::RLIMIT_CORE
. See Process.setrlimit
for details.
cur_limit and max_limit may be Process::RLIM_INFINITY
, Process::RLIM_SAVED_MAX
or Process::RLIM_SAVED_CUR
. See Process.setrlimit
and the system getrlimit(2) manual for details.
Get all [gem, version] from the command line.
An argument in the form gem:ver is pull apart into the gen name and version, respectively.
Get all gem names from the command line.
Get a single gem name from the command line. Fail if there is no gem name or if there is more than one gem name given.