Set
the effective user ID, and if possible, the saved user ID of the process to the given user. Returns the new effective user ID. Not available on all platforms.
[Process.uid, Process.euid] #=> [0, 0] Process::UID.grant_privilege(31) #=> 31 [Process.uid, Process.euid] #=> [0, 31]
Change the current process’s real and effective group ID to that specified by group. Returns the new group ID. Not available on all platforms.
[Process.gid, Process.egid] #=> [0, 0] Process::GID.change_privilege(33) #=> 33 [Process.gid, Process.egid] #=> [33, 33]
Set
the effective group ID, and if possible, the saved group ID of the process to the given group. Returns the new effective group ID. Not available on all platforms.
[Process.gid, Process.egid] #=> [0, 0] Process::GID.grant_privilege(31) #=> 33 [Process.gid, Process.egid] #=> [0, 33]
Processes the topmost available {RequirementState} on the stack @return [void]
Writes data
onto the IO
, raising a FileOverflow
exception if the number of bytes will be more than limit
Writes data
onto the IO
Re-composes a prime factorization and returns the product.
See Prime#int_from_prime_division
for more details.
Passes each grapheme cluster in str to the given block, or returns an enumerator if no block is given. Unlike String#each_char
, this enumerates by grapheme clusters defined by Unicode Standard Annex #29 unicode.org/reports/tr29/
"a\u0300".each_char.to_a.size #=> 2 "a\u0300".each_grapheme_cluster.to_a.size #=> 1
Returns a list of the public instance methods defined in mod. If the optional parameter is false
, the methods of any ancestors are not included.
Returns a list of the protected instance methods defined in mod. If the optional parameter is false
, the methods of any ancestors are not included.
Removes the definition of the sym, returning that constant’s value.
class Dummy @@var = 99 puts @@var remove_class_variable(:@@var) p(defined? @@var) end
produces:
99 nil
Returns the value of the given class variable (or throws a NameError
exception). The @@
part of the variable name should be included for regular class variables. String arguments are converted to symbols.
class Fred @@foo = 99 end Fred.class_variable_get(:@@foo) #=> 99
Sets the class variable named by symbol to the given object. If the class variable name is passed as a string, that string is converted to a symbol.
class Fred @@foo = 99 def foo @@foo end end Fred.class_variable_set(:@@foo, 101) #=> 101 Fred.new.foo #=> 101
Returns true
if the given class variable is defined in obj. String arguments are converted to symbols.
class Fred @@foo = 99 end Fred.class_variable_defined?(:@@foo) #=> true Fred.class_variable_defined?(:@@bar) #=> false
Similar to instance_method, searches public method only.
Returns true
if the named private method is defined by _ mod_ (or its included modules and, if mod is a class, its 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.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