Returns first n elements from enum.
a = [1, 2, 3, 4, 5, 0] a.take(3) #=> [1, 2, 3] a.take(30) #=> [1, 2, 3, 4, 5, 0]
Enables coverage measurement.
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.
Returns self, for backward compatibility.
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 readable by the effective user and group id of this process. See eaccess(3).
Returns true
if the named file is writable by the effective user and group id of this process. See eaccess(3).
Returns true
if the named file is executable by the effective user and group id of this process. See eaccess(3).
Initiates garbage collection, unless manually disabled.
This method is defined with keyword arguments that default to true:
def GC.start(full_mark: true, immediate_sweep: true); end
Use full_mark: false to perform a minor GC
. Use immediate_sweep: false to defer sweeping (use lazy sweep).
Note: These keyword arguments are implementation and version dependent. They are not guaranteed to be future-compatible, and may be ignored if the underlying implementation does not support them.
The standard configuration object for gems.
Use the given configuration object (which implements the ConfigFile
protocol) as the standard configuration object.
A Zlib::Deflate.deflate
wrapper
Retrieve the PathSupport
object that RubyGems uses to lookup files.
Initialize the filesystem paths to use from env
. env
is a hash-like object (typically ENV
) that is queried for ‘GEM_HOME’, ‘GEM_PATH’, and ‘GEM_SPEC_CACHE’ Keys for the env
hash should be Strings, and values of the hash should be Strings or nil
.
A Zlib::Inflate#inflate
wrapper
Top level install helper method. Allows you to install gems interactively:
% irb >> Gem.install "minitest" Fetching: minitest-3.0.1.gem (100%) => [#<Gem::Specification:0x1013b4528 @name="minitest", ...>]
Set
array of platforms this RubyGems supports (primarily for testing).
Array
of platforms this RubyGems supports.
Returns the tangent of z
, where z
is given in radians
CMath.tan(1 + 1i) #=> (0.27175258531951174+1.0839233273386943i)
Returns the hyperbolic tangent of z
, where z
is given in radians
CMath.tanh(1 + 1i) #=> (1.0839233273386943+0.27175258531951174i)
Returns the tangent of z
, where z
is given in radians
CMath.tan(1 + 1i) #=> (0.27175258531951174+1.0839233273386943i)
Returns the hyperbolic tangent of z
, where z
is given in radians
CMath.tanh(1 + 1i) #=> (1.0839233273386943+0.27175258531951174i)