Returns a list of paths matching glob
from the latest gems that can be used by a gem to pick up features from other gems. For example:
Gem.find_latest_files('rdoc/discover').each do |path| load path end
if check_load_path
is true (the default), then find_latest_files
also searches $LOAD_PATH for files as well as gems.
Unlike find_files
, find_latest_files
will return only files from the latest version of a gem.
Returns the latest release version of RubyGems.
Regexp
for require-able plugin suffixes.
Deduce Ruby’s –program-prefix and –program-suffix from its install name
Default options for gem commands for Ruby packagers.
The options here should be structured as an array of string “gem” command names as keys and a string of the default options as values.
Example:
def self.operating_system_defaults
{ 'install' => '--no-rdoc --no-ri --env-shebang', 'update' => '--no-rdoc --no-ri --env-shebang' }
end
Returns strongly connected components as an array of arrays of nodes. The array is sorted from children to parents. Each elements of the array represents a strongly connected component.
class G include TSort def initialize(g) @g = g end def tsort_each_child(n, &b) @g[n].each(&b) end def tsort_each_node(&b) @g.each_key(&b) end end graph = G.new({1=>[2, 3], 2=>[4], 3=>[2, 4], 4=>[]}) p graph.strongly_connected_components #=> [[4], [2], [3], [1]] graph = G.new({1=>[2], 2=>[3, 4], 3=>[2], 4=>[]}) p graph.strongly_connected_components #=> [[4], [2, 3], [1]]
Returns strongly connected components as an array of arrays of nodes. The array is sorted from children to parents. Each elements of the array represents a strongly connected component.
The graph is represented by each_node and each_child. each_node should have call
method which yields for each node in the graph. each_child should have call
method which takes a node argument and yields for each child node.
g = {1=>[2, 3], 2=>[4], 3=>[2, 4], 4=>[]} each_node = lambda {|&b| g.each_key(&b) } each_child = lambda {|n, &b| g[n].each(&b) } p TSort.strongly_connected_components(each_node, each_child) #=> [[4], [2], [3], [1]] g = {1=>[2], 2=>[3, 4], 3=>[2], 4=>[]} each_node = lambda {|&b| g.each_key(&b) } each_child = lambda {|n, &b| g[n].each(&b) } p TSort.strongly_connected_components(each_node, each_child) #=> [[4], [2, 3], [1]]
Should be implemented by a extended class.
tsort_each_node
is used to iterate for all nodes over a graph.
Should be implemented by a extended class.
tsort_each_child
is used to iterate for child nodes of node.
@return [Boolean] where the requirement of the state we’re unwinding
to directly caused the conflict. Note: in this case, it is impossible for the state we're unwinding to to be a parent of any of the other conflicting requirements (or we would have circularity)
@return [Array] array of all the requirements that led to the need for
this unwind
The line number in the source code where this AST’s text began.
The column number in the source code where this AST’s text began.
The line number in the source code where this AST’s text ended.
The column number in the source code where this AST’s text ended.
Returns all tokens for the input script regardless the receiver node. Returns nil
if keep_tokens
is not enabled when parse method is called.
root = RubyVM::AbstractSyntaxTree.parse("x = 1 + 2", keep_tokens: true) root.all_tokens # => [[0, :tIDENTIFIER, "x", [1, 0, 1, 1]], [1, :tSP, " ", [1, 1, 1, 2]], ...] root.children[-1].all_tokens # => [[0, :tIDENTIFIER, "x", [1, 0, 1, 1]], [1, :tSP, " ", [1, 1, 1, 2]], ...]
Encodes this DH
to its DER encoding. Note that any existing per-session public/private keys will not get encoded, just the Diffie-Hellman parameters will be encoded.
Encodes this DH
to its PEM encoding. Note that any existing per-session public/private keys will not get encoded, just the Diffie-Hellman parameters will be encoded.
Encodes this DSA
to its DER encoding.
Encodes this DSA
to its PEM encoding.
cipher is an OpenSSL::Cipher
.
password is a string containing your password.
DSA.to_pem -> aString DSA.to_pem(cipher, 'mypassword') -> aString
See the OpenSSL
documentation for i2d_ECPrivateKey_bio()
Outputs the EC
key in PEM encoding. If cipher and pass_phrase are given they will be used to encrypt the key. cipher must be an OpenSSL::Cipher
instance. Note that encryption will only be effective for a private key, public keys will always be encoded in plain text.
Outputs this keypair in DER encoding.
Signs data using the Probabilistic Signature Scheme (RSA-PSS) and returns the calculated signature.
RSAError
will be raised if an error occurs.
See verify_pss
for the verification operation.
A String
containing the message digest algorithm name.
A String
. The data to be signed.
The length in octets of the salt. Two special values are reserved: :digest
means the digest length, and :max
means the maximum possible length for the combination of the private key and the selected message digest algorithm.
The hash algorithm used in MGF1 (the currently supported mask generation function (MGF)).
data = "Sign me!" pkey = OpenSSL::PKey::RSA.new(2048) signature = pkey.sign_pss("SHA256", data, salt_length: :max, mgf1_hash: "SHA256") pub_key = OpenSSL::PKey.read(pkey.public_to_der) puts pub_key.verify_pss("SHA256", signature, data, salt_length: :auto, mgf1_hash: "SHA256") # => true