Returns current locale id (lcid). The default locale is WIN32OLE::LOCALE_SYSTEM_DEFAULT
.
lcid = WIN32OLE.locale
Sets current locale id (lcid).
WIN32OLE.locale = 1033 # set locale English(U.S) obj = WIN32OLE_VARIANT.new("$100,000", WIN32OLE::VARIANT::VT_CY)
If the given key
is found, returns a 2-element Array containing that key and its value:
h = {foo: 0, bar: 1, baz: 2} h.assoc(:bar) # => [:bar, 1]
Returns nil
if key key
is not found.
Returns a new 2-element Array consisting of the key and value of the first-found entry whose value is ==
to value (see Entry Order):
h = {foo: 0, bar: 1, baz: 1} h.rassoc(1) # => [:bar, 1]
Returns nil
if no such value found.
Returns a 2-element Array
containing the name and value of the environment variable for name
if it exists:
ENV.replace('foo' => '0', 'bar' => '1') ENV.assoc('foo') # => ['foo', '0']
Returns nil
if name
is a valid String
and there is no such environment variable.
Returns nil
if name
is the empty String
or is a String
containing character '='
.
Raises an exception if name
is a String
containing the NUL character "\0"
:
ENV.assoc("\0") # Raises ArgumentError (bad environment variable name: contains null byte)
Raises an exception if name
has an encoding that is not ASCII-compatible:
ENV.assoc("\xa1\xa1".force_encoding(Encoding::UTF_16LE)) # Raises ArgumentError (bad environment variable name: ASCII incompatible encoding: UTF-16LE)
Raises an exception if name
is not a String:
ENV.assoc(Object.new) # TypeError (no implicit conversion of Object into String)
Returns a 2-element Array
containing the name and value of the first found environment variable that has value value
, if one exists:
ENV.replace('foo' => '0', 'bar' => '0') ENV.rassoc('0') # => ["bar", "0"]
The order in which environment variables are examined is OS-dependent. See About Ordering.
Returns nil
if there is no such environment variable.
Writes the given object(s) to ios. Returns nil
.
The stream must be opened for writing. Each given object that isn’t a string will be converted by calling its to_s
method. When called without arguments, prints the contents of $_
.
If the output field separator ($,
) is not nil
, it is inserted between objects. If the output record separator ($\
) is not nil
, it is appended to the output.
$stdout.print("This is ", 100, " percent.\n")
produces:
This is 100 percent.
Formats and writes to ios, converting parameters under control of the format string. See Kernel#sprintf
for details.
Sets optional filename and line number that will be used in ERB
code evaluation and error reporting. See also filename=
and lineno=
erb = ERB.new('<%= some_x %>') erb.render # undefined local variable or method `some_x' # from (erb):1 erb.location = ['file.erb', 3] # All subsequent error reporting would use new location erb.render # undefined local variable or method `some_x' # from file.erb:4
Returns true if the ipaddr is a private address. IPv4 addresses in 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16 as defined in RFC 1918 and IPv6 Unique Local Addresses in fc00::/7 as defined in RFC 4193 are considered private.
Returns the prefix length in bits for the ipaddr.
Sets the prefix length in bits
Returns true
iff the current severity level allows for the printing of ERROR
messages.
Sets the severity to ERROR.
Creates a matrix where rows
is an array of arrays, each of which is a row of the matrix. If the optional argument copy
is false, use the given arrays as the internal structure of the matrix without copying.
Matrix.rows([[25, 93], [-1, 66]]) # => 25 93 # -1 66
Returns row vector number i
of the matrix as a Vector
(starting at 0 like an array). When a block is given, the elements of that vector are iterated.
Returns true
if this is a matrix with only zero elements
Returns a matrix with entries rounded to the given precision (see Float#round
)
Returns a vector with entries rounded to the given precision (see Float#round
)
Returns true
iff all elements are zero.