Returns array of type libraries. This method will be OBSOLETE. Use WIN32OLE_TYPELIB.typelibs
.collect{|t| t.name} instead.
WIN32OLE_TYPELIB.typelibs
Returns the array of WIN32OLE_TYPELIB
object.
tlibs = WIN32OLE_TYPELIB.typelibs
Replaces the contents of hsh with the contents of other_hash.
h = { "a" => 100, "b" => 200 } h.replace({ "c" => 300, "d" => 400 }) #=> {"c"=>300, "d"=>400}
Replaces the contents of the environment variables with the contents of hash
.
This is a deprecated alias for each_line
.
Reads ARGF
‘s current file in its entirety, returning an Array
of its lines, one line per element. Lines are assumed to be separated by sep.
lines = ARGF.readlines lines[0] #=> "This is line one\n"
Returns the next line from the current file in ARGF
.
By default lines are assumed to be separated by $/
; to use a different character as a separator, supply it as a String
for the sep argument.
The optional limit argument specifies how many characters of each line to return. By default all characters are returned.
An EOFError
is raised at the end of the file.
Returns the current line number of ARGF
as a whole. This value can be set manually with ARGF.lineno=
.
For example:
ARGF.lineno #=> 0 ARGF.readline #=> "This is line 1\n" ARGF.lineno #=> 1
Sets the line number of ARGF
as a whole to the given Integer
.
ARGF
sets the line number automatically as you read data, so normally you will not need to set it explicitly. To access the current line number use ARGF.lineno
.
For example:
ARGF.lineno #=> 0 ARGF.readline #=> "This is line 1\n" ARGF.lineno #=> 1 ARGF.lineno = 0 #=> 0 ARGF.lineno #=> 0
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.
Alias for CSV::read()
.
Returns the bound receiver of the binding object.
Returns true
if this is a symmetric matrix. Raises an error if matrix is not square.
Returns the trace (sum of diagonal elements) of the matrix.
Matrix[[7,6], [3,9]].trace => 16
The coerce method provides support for Ruby type coercion. This coercion mechanism is used by Ruby to handle mixed-type numeric operations: it is intended to find a compatible common type between the two operands of the operator. See also Numeric#coerce
.
Returns a new vector with the same direction but with norm 1.
v = Vector[5,8,2].normalize # => Vector[0.5184758473652127, 0.8295613557843402, 0.20739033894608505] v.norm => 1.0
The coerce method provides support for Ruby type coercion. This coercion mechanism is used by Ruby to handle mixed-type numeric operations: it is intended to find a compatible common type between the two operands of the operator. See also Numeric#coerce
.
Directs to accept specified class t
. The argument string is passed to the block in which it should be converted to the desired class.
t
Argument class specifier, any object including Class
.
pat
Pattern for argument, defaults to t
if it responds to match.
accept(t, pat, &block)
Returns an array with both a numeric
and a big
represented as Bignum objects.
This is achieved by converting numeric
to a Bignum.
A TypeError
is raised if the numeric
is not a Fixnum or Bignum type.
(0x3FFFFFFFFFFFFFFF+1).coerce(42) #=> [42, 4611686018427387904]
Returns the smallest number than or equal to int
in decimal digits (default 0 digits).
Precision may be negative. Returns a floating point number when ndigits
is positive, self
for zero, and ceil up for negative.
1.ceil #=> 1 1.ceil(2) #=> 1.0 15.ceil(-1) #=> 20
Returns the value as a rational. The optional argument eps is always ignored.
Replaces the contents of the set with the contents of the given enumerable object and returns self.