Terminates thr
and schedules another thread to be run.
If this thread is already marked to be killed, exit
returns the Thread
.
If this is the main thread, or the last thread, exits the process.
Returns the name at the definition of the current method as a Symbol
. If called outside of a method, it returns nil
.
Returns x/y
or arg
as a Rational
.
Rational(2, 3) #=> (2/3) Rational(5) #=> (5/1) Rational(0.5) #=> (1/2) Rational(0.3) #=> (5404319552844595/18014398509481984) Rational("2/3") #=> (2/3) Rational("0.3") #=> (3/10) Rational("10 cents") #=> ArgumentError Rational(nil) #=> TypeError Rational(1, nil) #=> TypeError Rational("10 cents", exception: false) #=> nil
Syntax of the string form:
string form = extra spaces , rational , extra spaces ; rational = [ sign ] , unsigned rational ; unsigned rational = numerator | numerator , "/" , denominator ; numerator = integer part | fractional part | integer part , fractional part ; denominator = digits ; integer part = digits ; fractional part = "." , digits , [ ( "e" | "E" ) , [ sign ] , digits ] ; sign = "-" | "+" ; digits = digit , { digit | "_" , digit } ; digit = "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" ; extra spaces = ? \s* ? ;
See also String#to_r
.
Returns the /etc/passwd information for the user with specified login name
.
The information is returned as a Passwd
struct.
See the unix manpage for getpwnam(3)
for more detail.
Etc.getpwnam('root') #=> #<struct Etc::Passwd name="root", passwd="x", uid=0, gid=0, gecos="root",dir="/root", shell="/bin/bash">
Returns information about the group with specified name
, as found in /etc/group.
The information is returned as a Group
struct.
See the unix manpage for getgrnam(3)
for more detail.
Etc.getgrnam('users') #=> #<struct Etc::Group name="users", passwd="x", gid=100, mem=["meta", "root"]>
Returns the path to the trusted certificate with the given ASN.1 name
Returns a list of the private instance methods defined in mod. If the optional parameter is false
, the methods of any ancestors are not included.
module Mod def method1() end private :method1 def method2() end end Mod.instance_methods #=> [:method2] Mod.private_instance_methods #=> [:method1]
Returns true
if the named private method is defined by mod. If inherit is set, the lookup will also search mod’s ancestors. String
arguments are converted to symbols.
module A def method1() end end class B private def method2() end end class C < B include A def method3() end end A.method_defined? :method1 #=> true C.private_method_defined? "method1" #=> false C.private_method_defined? "method2" #=> true C.private_method_defined? "method2", true #=> true C.private_method_defined? "method2", false #=> false C.method_defined? "method2" #=> false
Makes existing class methods private. Often used to hide the default constructor new
.
String
arguments are converted to symbols.
class SimpleSingleton # Not thread safe private_class_method :new def SimpleSingleton.create(*args, &block) @me = new(*args, &block) if ! @me @me end end
Returns the directories in the current shell’s PATH environment variable as an array of directory names. This sets the system_path
for all instances of Shell
.
Example: If in your current shell, you did:
$ echo $PATH /usr/bin:/bin:/usr/local/bin
Running this method in the above shell would then return:
["/usr/bin", "/bin", "/usr/local/bin"]
Sets the system_path
that new instances of Shell
should have as their initial system_path.
path
should be an array of directory name strings.
Returns the method identifier for the given object
.
class A include ObjectSpace def foo trace_object_allocations do obj = Object.new p "#{allocation_class_path(obj)}##{allocation_method_id(obj)}" end end end A.new.foo #=> "Class#new"
See ::trace_object_allocations
for more information and examples.
Sets a list of characters that cause a filename to be quoted by the completer when they appear in a completed filename. The default is nil.
Raises NotImplementedError
if the using readline library does not support.
Gets a list of characters that cause a filename to be quoted by the completer when they appear in a completed filename.
Raises NotImplementedError
if the using readline library does not support.
The default signing key path
The default signing certificate chain path
| RelativeLocationPath | '/' RelativeLocationPath? | '//' RelativeLocationPath
Downloads uri
to path
if necessary. If no path is given, it just passes the data.