Allocate size
bytes of memory and return the integer memory address for the allocated memory.
Generate a JSON
document from the Ruby data structure obj and return it. state is * a JSON::State object,
or a Hash
like object (responding to to_hash),
an object convertible into a hash by a to_h method,
that is used as or to configure a State object.
It defaults to a state object, that creates the shortest possible JSON
text in one line, checks for circular data structures and doesn’t allow NaN
, Infinity
, and -Infinity.
A state hash can have the following keys:
indent: a string used to indent levels (default: ”),
space: a string that is put after, a : or , delimiter (default: ”),
space_before: a string that is put before a : pair delimiter (default: ”),
object_nl: a string that is put at the end of a JSON
object (default: ”),
array_nl: a string that is put at the end of a JSON
array (default: ”),
allow_nan: true if NaN
, Infinity
, and -Infinity should be generated, otherwise an exception is thrown if these values are encountered. This options defaults to false.
max_nesting: The maximum depth of nesting allowed in the data structures from which JSON
is to be generated. Disable depth checking with :max_nesting => false, it defaults to 100.
See also the fast_generate
for the fastest creation method with the least amount of sanity checks, and the pretty_generate
method for some defaults for pretty output.
Checks the status of the child process specified by pid
. Returns nil
if the process is still alive.
If the process is not alive, and raise
was true, a PTY::ChildExited
exception will be raised. Otherwise it will return a Process::Status
instance.
pid
The process id of the process to check
raise
If true
and the process identified by pid
is no longer alive a PTY::ChildExited
is raised.
Returns the log priority mask in effect. The mask is not reset by opening or closing syslog.
Sets the log priority mask. A method LOG_UPTO is defined to make it easier to set mask values. Example:
Syslog.mask = Syslog::LOG_UPTO(Syslog::LOG_ERR)
Alternatively, specific priorities can be selected and added together using binary OR. Example:
Syslog.mask = Syslog::LOG_MASK(Syslog::LOG_ERR) | Syslog::LOG_MASK(Syslog::LOG_CRIT)
The priority mask persists through calls to open() and close().
Compresses the given string
. Valid values of level are Zlib::NO_COMPRESSION
, Zlib::BEST_SPEED
, Zlib::BEST_COMPRESSION
, Zlib::DEFAULT_COMPRESSION
, or an integer from 0 to 9.
This method is almost equivalent to the following code:
def deflate(string, level) z = Zlib::Deflate.new(level) dst = z.deflate(string, Zlib::FINISH) z.close dst end
See also Zlib.inflate
Decompresses string
. Raises a Zlib::NeedDict
exception if a preset dictionary is needed for decompression.
This method is almost equivalent to the following code:
def inflate(string) zstream = Zlib::Inflate.new buf = zstream.inflate(string) zstream.finish zstream.close buf end
See also Zlib.deflate
Returns true
if the named file is a character device.
file_name can be an IO
object.
Returns a Hash
containing information about the GC
.
The hash includes information about internal statistics about GC
such as:
{ :count=>0, :heap_allocated_pages=>24, :heap_sorted_length=>24, :heap_allocatable_pages=>0, :heap_available_slots=>9783, :heap_live_slots=>7713, :heap_free_slots=>2070, :heap_final_slots=>0, :heap_marked_slots=>0, :heap_eden_pages=>24, :heap_tomb_pages=>0, :total_allocated_pages=>24, :total_freed_pages=>0, :total_allocated_objects=>7796, :total_freed_objects=>83, :malloc_increase_bytes=>2389312, :malloc_increase_bytes_limit=>16777216, :minor_gc_count=>0, :major_gc_count=>0, :remembered_wb_unprotected_objects=>0, :remembered_wb_unprotected_objects_limit=>0, :old_objects=>0, :old_objects_limit=>0, :oldmalloc_increase_bytes=>2389760, :oldmalloc_increase_bytes_limit=>16777216 }
The contents of the hash are implementation specific and may be changed in the future.
This method is only expected to work on C Ruby.
Returns the arc tangent of z
CMath.atan(1 + 1i) #=> (1.0172219678978514+0.4023594781085251i)
returns the arc tangent of y
divided by x
using the signs of y
and x
to determine the quadrant
CMath.atan2(1 + 1i, 0) #=> (1.5707963267948966+0.0i)
returns the inverse hyperbolic tangent of z
CMath.atanh(1 + 1i) #=> (0.4023594781085251+1.0172219678978514i)
Returns the arc tangent of z
CMath.atan(1 + 1i) #=> (1.0172219678978514+0.4023594781085251i)
returns the arc tangent of y
divided by x
using the signs of y
and x
to determine the quadrant
CMath.atan2(1 + 1i, 0) #=> (1.5707963267948966+0.0i)
returns the inverse hyperbolic tangent of z
CMath.atanh(1 + 1i) #=> (0.4023594781085251+1.0172219678978514i)
Returns true if new
is newer than all old_list
. Non-existent files are older than any file.
FileUtils.uptodate?('hello.o', %w(hello.c hello.h)) or \ system 'make hello.o'
Returns true if new
is newer than all old_list
. Non-existent files are older than any file.
FileUtils.uptodate?('hello.o', %w(hello.c hello.h)) or \ system 'make hello.o'
Changes permission bits on the named files (in list
) to the bit pattern represented by mode
.
mode
is the symbolic and absolute mode can be used.
Absolute mode is
FileUtils.chmod 0755, 'somecommand' FileUtils.chmod 0644, %w(my.rb your.rb his.rb her.rb) FileUtils.chmod 0755, '/usr/bin/ruby', :verbose => true
Symbolic mode is
FileUtils.chmod "u=wrx,go=rx", 'somecommand' FileUtils.chmod "u=wr,go=rr", %w(my.rb your.rb his.rb her.rb) FileUtils.chmod "u=wrx,go=rx", '/usr/bin/ruby', :verbose => true
is user, group, other mask.
is user’s mask.
is group’s mask.
is other’s mask.
is write permission.
is read permission.
is execute permission.
is execute permission for directories only, must be used in conjunction with “+”
is uid, gid.
is sticky bit.
is added to a class given the specified mode.
Is removed from a given class given mode.
Is the exact nature of the class will be given a specified mode.
Changes permission bits on the named files (in list
) to the bit pattern represented by mode
.
mode
is the symbolic and absolute mode can be used.
Absolute mode is
FileUtils.chmod 0755, 'somecommand' FileUtils.chmod 0644, %w(my.rb your.rb his.rb her.rb) FileUtils.chmod 0755, '/usr/bin/ruby', :verbose => true
Symbolic mode is
FileUtils.chmod "u=wrx,go=rx", 'somecommand' FileUtils.chmod "u=wr,go=rr", %w(my.rb your.rb his.rb her.rb) FileUtils.chmod "u=wrx,go=rx", '/usr/bin/ruby', :verbose => true
is user, group, other mask.
is user’s mask.
is group’s mask.
is other’s mask.
is write permission.
is read permission.
is execute permission.
is execute permission for directories only, must be used in conjunction with “+”
is uid, gid.
is sticky bit.
is added to a class given the specified mode.
Is removed from a given class given mode.
Is the exact nature of the class will be given a specified mode.