Returns system configuration variable using confstr().
name should be a constant under Etc
which begins with CS_
.
The return value is a string or nil. nil means no configuration-defined value. (confstr() returns 0 but errno is not set.)
Etc.confstr(Etc::CS_PATH) #=> "/bin:/usr/bin" # GNU/Linux Etc.confstr(Etc::CS_GNU_LIBC_VERSION) #=> "glibc 2.18" Etc.confstr(Etc::CS_GNU_LIBPTHREAD_VERSION) #=> "NPTL 2.18"
Returns current status of GC stress mode.
Updates the GC stress mode.
When stress mode is enabled, the GC is invoked at every GC opportunity: all memory and object allocations.
Enabling stress mode will degrade performance, it is only for debugging.
flag can be true, false, or an integer bit-ORed following flags.
0x01:: no major GC 0x02:: no immediate sweep 0x04:: full mark after malloc/calloc/realloc
Returns the scheduling priority for specified process, process group, or user.
Argument kind
is one of:
Process::PRIO_PROCESS
: return priority for process.
Process::PRIO_PGRP
: return priority for process group.
Process::PRIO_USER
: return priority for user.
Argument id
is the ID for the process, process group, or user; zero specified the current ID for kind
.
Examples:
Process.getpriority(Process::PRIO_USER, 0) # => 19 Process.getpriority(Process::PRIO_PROCESS, 0) # => 19
Not available on all platforms.
See Process.getpriority
.
Examples:
Process.setpriority(Process::PRIO_USER, 0, 19) # => 0 Process.setpriority(Process::PRIO_PROCESS, 0, 19) # => 0 Process.getpriority(Process::PRIO_USER, 0) # => 19 Process.getpriority(Process::PRIO_PROCESS, 0) # => 19
Not available on all platforms.
Performs a Miller-Rabin probabilistic primality test for bn
.
Deprecated in version 3.0. Use prime?
instead.
checks
and trial_div
parameters no longer have any effect.
Called with encoding
when the YAML
stream starts. This method is called once per stream. A stream may contain multiple documents.
See the constants in Psych::Parser
for the possible values of encoding
.
Read a chunk or all of the buffer into a string, in the specified encoding
. If no encoding is provided Encoding::BINARY
is used.
buffer = IO::Buffer.for('test') buffer.get_string # => "test" buffer.get_string(2) # => "st" buffer.get_string(2, 1) # => "s"
Efficiently copy from a source String
into the buffer, at offset
using memcpy
.
buf = IO::Buffer.new(8) # => # #<IO::Buffer 0x0000557412714a20+8 INTERNAL> # 0x00000000 00 00 00 00 00 00 00 00 ........ # set buffer starting from offset 1, take 2 bytes starting from string's # second buf.set_string('test', 1, 2, 1) # => 2 buf # => # #<IO::Buffer 0x0000557412714a20+8 INTERNAL> # 0x00000000 00 65 73 00 00 00 00 00 .es.....
See also copy
for examples of how buffer writing might be used for changing associated strings and files.
def attribute_write?: () -> bool
def attribute_write?: () -> bool
def attribute_write?: () -> bool
def attribute_write?: () -> bool
def attribute_write?: () -> bool
def attribute_write?: () -> bool
def attribute_write?: () -> bool
def attribute_write?: () -> bool
def attribute_write?: () -> bool
Sanitize a single string.
If the SOURCE_DATE_EPOCH environment variable is set, returns it’s value. Otherwise, returns the time that Gem.source_date_epoch_string
was first called in the same format as SOURCE_DATE_EPOCH.
NOTE(@duckinator): The implementation is a tad weird because we want to:
1. Make builds reproducible by default, by having this function always return the same result during a given run. 2. Allow changing ENV['SOURCE_DATE_EPOCH'] at runtime, since multiple tests that set this variable will be run in a single process.
If you simplify this function and a lot of tests fail, that is likely due to #2 above.
Details on SOURCE_DATE_EPOCH: reproducible-builds.org/specs/source-date-epoch/