Validates the Diffie-Hellman parameters associated with this instance. It checks whether a safe prime and a suitable generator are used. If this is not the case, false
is returned.
Sets saner defaults optimized for the use with HTTP-like protocols.
If a Hash
params
is given, the parameters are overridden with it. The keys in params
must be assignment methods on SSLContext
.
If the verify_mode
is not VERIFY_NONE and ca_file
, ca_path
and cert_store
are not set then the system default certificate store is used.
Extracts the Gem::Specification
and raw metadata from the .gem file at path
.
Extracts the certificate chain from the spec
and calls verify
to ensure the signatures and certificate chain is valid according to the policy..
Raises a MissingTagError
or NotExpectedTagError
if the element is not properly formatted.
Raises NotAvailableValueError
if element content is nil
(see Gem::Resolver::Molinillo::ResolutionState#name)
Returns the element at index
. A negative index counts from the end of self
. Returns nil
if the index is out of range. See also Array#[]
.
a = [ "a", "b", "c", "d", "e" ] a.at(0) #=> "a" a.at(-1) #=> "e"
Appends the elements of +other_ary+s to self
.
[ "a", "b" ].concat( ["c", "d"] ) #=> [ "a", "b", "c", "d" ] [ "a" ].concat( ["b"], ["c", "d"] ) #=> [ "a", "b", "c", "d" ] [ "a" ].concat #=> [ "a" ] a = [ 1, 2, 3 ] a.concat( [ 4, 5 ] ) a #=> [ 1, 2, 3, 4, 5 ] a = [ 1, 2 ] a.concat(a, a) #=> [1, 2, 1, 2, 1, 2]
See also Array#+
.
Returns the number of elements in self
. May be zero.
[ 1, 2, 3, 4, 5 ].length #=> 5 [].length #=> 0
Returns a new array by rotating self
so that the element at count
is the first element of the new array.
If count
is negative then it rotates in the opposite direction, starting from the end of self
where -1
is the last element.
a = [ "a", "b", "c", "d" ] a.rotate #=> ["b", "c", "d", "a"] a #=> ["a", "b", "c", "d"] a.rotate(2) #=> ["c", "d", "a", "b"] a.rotate(-3) #=> ["b", "c", "d", "a"]
Rotates self
in place so that the element at count
comes first, and returns self
.
If count
is negative then it rotates in the opposite direction, starting from the end of the array where -1
is the last element.
a = [ "a", "b", "c", "d" ] a.rotate! #=> ["b", "c", "d", "a"] a #=> ["b", "c", "d", "a"] a.rotate!(2) #=> ["d", "a", "b", "c"] a.rotate!(-3) #=> ["a", "b", "c", "d"]
Returns a copy of self
with all nil
elements removed.
[ "a", nil, "b", nil, "c", nil ].compact #=> [ "a", "b", "c" ]
Removes nil
elements from the array.
Returns nil
if no changes were made, otherwise returns the array.
[ "a", nil, "b", nil, "c" ].compact! #=> [ "a", "b", "c" ] [ "a", "b", "c" ].compact! #=> nil
Returns a new array that is a one-dimensional flattening of self
(recursively).
That is, for every element that is an array, extract its elements into the new array.
The optional level
argument determines the level of recursion to flatten.
s = [ 1, 2, 3 ] #=> [1, 2, 3] t = [ 4, 5, 6, [7, 8] ] #=> [4, 5, 6, [7, 8]] a = [ s, t, 9, 10 ] #=> [[1, 2, 3], [4, 5, 6, [7, 8]], 9, 10] a.flatten #=> [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] a = [ 1, 2, [3, [4, 5] ] ] a.flatten(1) #=> [1, 2, 3, [4, 5]]