Returns the header field corresponding to the case-insensitive key. Returns the default value args
, or the result of the block, or raises an IndexError
if there’s no header field named key
See Hash#fetch
Switch the effective and real user IDs of the current process. If a block is given, the user IDs will be switched back after the block is executed. Returns the new effective user ID if called without a block, and the return value of the block if one is given.
Switch the effective and real group IDs of the current process. If a block is given, the group IDs will be switched back after the block is executed. Returns the new effective group ID if called without a block, and the return value of the block if one is given.
Downloads uri
to path
if necessary. If no path is given, it just passes the data.
Returns a relative path from the given base_directory
to the receiver.
If self
is absolute, then base_directory
must be absolute too.
If self
is relative, then base_directory
must be relative too.
This method doesn’t access the filesystem. It assumes no symlinks.
ArgumentError
is raised when it cannot find a relative path.
Note that this method does not handle situations where the case sensitivity of the filesystem in use differs from the operating system default.
Returns the class for the given object
.
class A def foo ObjectSpace::trace_object_allocations do obj = Object.new p "#{ObjectSpace::allocation_class_path(obj)}" end end end A.new.foo #=> "Class"
See ::trace_object_allocations
for more information and examples.
Returns the size of memory allocated by malloc().
Only available if ruby was built with CALC_EXACT_MALLOC_SIZE
.
The number of paths in the +$LOAD_PATH+ from activated gems. Used to prioritize -I
and +ENV+ entries during require
.
Returns the value of Gem.source_date_epoch_string
, as a Time
object.
This is used throughout RubyGems for enabling reproducible builds.
Deduce Ruby’s –program-prefix and –program-suffix from its install name
Should be implemented by a extended class.
tsort_each_child
is used to iterate for child nodes of node.
Returns a new lazy enumerator with the concatenated results of running block
once for every element in the lazy enumerator.
["foo", "bar"].lazy.flat_map {|i| i.each_char.lazy}.force #=> ["f", "o", "o", "b", "a", "r"]
A value x
returned by block
is decomposed if either of the following conditions is true:
x
responds to both each and force, which means that x
is a lazy enumerator.
x
is an array or responds to to_ary.
Otherwise, x
is contained as-is in the return value.
[{a:1}, {b:2}].lazy.flat_map {|i| i}.force #=> [{:a=>1}, {:b=>2}]
See Zlib::GzipReader
documentation for a description.
Iterate all direct child instruction sequences. Iteration order is implementation/version defined so that people should not rely on the order.
Main name of the switch.