Loads the given certificate_file
See the OpenSSL
documentation for EC_GROUP_get0_generator()
Inserts the given values before the element with the given index
.
Negative indices count backwards from the end of the array, where -1
is the last element. If a negative index is used, the given values will be inserted after that element, so using an index of -1
will insert the values at the end of the array.
a = %w{ a b c d } a.insert(2, 99) #=> ["a", "b", 99, "c", "d"] a.insert(-2, 1, 2, 3) #=> ["a", "b", 99, "c", 1, 2, 3, "d"]
Returns a new array containing self
‘s elements in reverse order.
[ "a", "b", "c" ].reverse #=> ["c", "b", "a"] [ 1 ].reverse #=> [1]
Reverses self
in place.
a = [ "a", "b", "c" ] a.reverse! #=> ["c", "b", "a"] a #=> ["c", "b", "a"]
When invoked with a block, yield all permutations of length n
of the elements of the array, then return the array itself.
If n
is not specified, yield all permutations of all elements.
The implementation makes no guarantees about the order in which the permutations are yielded.
If no block is given, an Enumerator
is returned instead.
Examples:
a = [1, 2, 3] a.permutation.to_a #=> [[1,2,3],[1,3,2],[2,1,3],[2,3,1],[3,1,2],[3,2,1]] a.permutation(1).to_a #=> [[1],[2],[3]] a.permutation(2).to_a #=> [[1,2],[1,3],[2,1],[2,3],[3,1],[3,2]] a.permutation(3).to_a #=> [[1,2,3],[1,3,2],[2,1,3],[2,3,1],[3,1,2],[3,2,1]] a.permutation(0).to_a #=> [[]] # one permutation of length 0 a.permutation(4).to_a #=> [] # no permutations of length 4
provides a unified clone
operation, for REXML::XPathParser
to use across multiple Object+ types
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 big modulo other. See Numeric.divmod
for more information.
Returns the remainder after dividing big by numeric.
-1234567890987654321.remainder(13731) #=> -6966 -1234567890987654321.remainder(13731.24) #=> -9906.22531493148
Returns the numerator.
1 2 3+4i <- numerator - + -i -> ---- 2 3 6 <- denominator c = Complex('1/2+2/3i') #=> ((1/2)+(2/3)*i) n = c.numerator #=> (3+4i) d = c.denominator #=> 6 n / d #=> ((1/2)+(2/3)*i) Complex(Rational(n.real, d), Rational(n.imag, d)) #=> ((1/2)+(2/3)*i)
See denominator.
If a numeric
is the same type as num
, returns an array containing numeric
and num
. Otherwise, returns an array with both a numeric
and num
represented as Float
objects.
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.
1.coerce(2.5) #=> [2.5, 1.0] 1.2.coerce(3) #=> [3.0, 1.2] 1.coerce(2) #=> [2, 1]