Removes all nil values from the hash. Returns nil if no changes were made, otherwise returns the hash.
h = { a: 1, b: false, c: nil } h.compact! #=> { a: 1, b: false }
Returns true
if the given key is present in hsh.
h = { "a" => 100, "b" => 200 } h.has_key?("a") #=> true h.has_key?("z") #=> false
Note that include?
and member?
do not test member equality using ==
as do other Enumerables.
See also Enumerable#include?
Same as ENV.delete_if
, but works on (and returns) a copy of the environment.
Equivalent to ENV.delete_if
but returns nil
if no changes were made.
Returns an Enumerator
if no block was given.
Returns the contents of the environment as a String
.
Returns true
if there is an environment variable with the given name
.
Reads at most maxlen bytes from the ARGF
stream.
If the optional outbuf argument is present, it must reference a String
, which will receive the data. The outbuf will contain only the received data after the method call even if it is not empty at the beginning.
It raises EOFError
on end of ARGF
stream. Since ARGF
stream is a concatenation of multiple files, internally EOF is occur for each file. ARGF.readpartial
returns empty strings for EOFs except the last one and raises EOFError
for the last one.
Returns “ARGF”.
This method will return a CSV
instance, just like CSV::new()
, but the instance will be cached and returned for all future calls to this method for the same data
object (tested by Object#object_id()
) with the same options
.
If a block is given, the instance is passed to the block and the return value becomes the return value of the block.
Returns the current list of converters in effect. See CSV::new
for details. Built-in converters will be returned by name, while others will be returned as is.
You can use this method to install a CSV::Converters
built-in, or provide a block that handles a custom conversion.
If you provide a block that takes one argument, it will be passed the field and is expected to return the converted value or the field itself. If your block takes two arguments, it will also be passed a CSV::FieldInfo
Struct
, containing details about the field. Again, the block should return a converted field or the field itself.
Start tracing
Tracer.on # code to trace here Tracer.off
You can also pass a block:
Tracer.on { # trace everything in this block }
Returns the list of waiting threads.
When stepping through the traces of a function, thread gets suspended, to be resumed later.
Untrust both the object returned by _getobj_ and self.
Untaint both the object returned by _getobj_ and self.
Generate results and print them. (see ERB#result
)
Returns true if the given ipaddr is in the range.
e.g.:
require 'ipaddr' net1 = IPAddr.new("192.168.2.0/24") net2 = IPAddr.new("192.168.2.100") net3 = IPAddr.new("192.168.3.0") p net1.include?(net2) #=> true p net1.include?(net3) #=> false
Returns a network byte ordered string form of the IP address.
Returns a new ipaddr built by converting the IPv6 address into a native IPv4 address. If the IP address is not an IPv4-mapped or IPv4-compatible IPv6 address, returns self.
Returns a string containing a human-readable representation of the ipaddr. (“#<IPAddr: family:address/mask>”)
Log an UNKNOWN
message. This will be printed no matter what the logger’s level is.
See info
for more information.
Creates a matrix where the diagonal elements are composed of values
.
Matrix.diagonal(9, 5, -3) => 9 0 0 0 5 0 0 0 -3