Returns a parse result whose value is an array of tokens that closely resembles the return value of Ripper::lex
. The main difference is that the ‘:on_sp` token is not emitted.
For supported options, see Prism::parse
.
The iterator version of the tsort
method. obj.tsort_each
is similar to obj.tsort.each
, but modification of obj during the iteration may lead to unexpected results.
tsort_each
returns nil
. If there is a cycle, TSort::Cyclic
is raised.
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=>[]}) graph.tsort_each {|n| p n } #=> 4 # 2 # 3 # 1
The iterator version of the TSort.tsort
method.
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) } TSort.tsort_each(each_node, each_child) {|n| p n } #=> 4 # 2 # 3 # 1
Returns a Process::Status
object representing the most recently exited child process in the current thread, or nil
if none:
Process.spawn('ruby', '-e', 'exit 13') Process.wait Process.last_status # => #<Process::Status: pid 14396 exit 13> Process.spawn('ruby', '-e', 'exit 14') Process.wait Process.last_status # => #<Process::Status: pid 4692 exit 14> Process.spawn('ruby', '-e', 'exit 15') # 'exit 15' has not been reaped by #wait. Process.last_status # => #<Process::Status: pid 4692 exit 14> Process.wait Process.last_status # => #<Process::Status: pid 1380 exit 15>
Sets the minimum and maximum supported protocol versions. See min_version=
and max_version=
.
Returns AST nodes under this one. Each kind of node has different children, depending on what kind of node it is.
The returned array may contain other nodes or nil
.
Creates a new DH
instance from scratch by generating random parameters and a key pair.
See also OpenSSL::PKey.generate_parameters
and OpenSSL::PKey.generate_key
.
size
The desired key size in bits.
generator
The generator.
Indicates whether this DH
instance has a private key associated with it or not. The private key may be retrieved with DH#priv_key.
Creates a new DSA
instance by generating a private/public key pair from scratch.
See also OpenSSL::PKey.generate_parameters
and OpenSSL::PKey.generate_key
.
size
The desired key size in bits.
Indicates whether this DSA
instance has a private key associated with it or not. The private key may be retrieved with DSA#private_key.
Creates a new EC
instance with a new random private and public key.
Returns whether this EC
instance has a private key. The private key (BN
) can be retrieved with EC#private_key
.
Generates an RSA keypair.
See also OpenSSL::PKey.generate_key
.
size
The desired key size in bits.
exponent
An odd Integer
, normally 3, 17, or 65537.
Does this keypair contain a private key?
A description of the current connection state. This is for diagnostic purposes only.
Returns the verified chain.
See also the man page X509_STORE_CTX_set0_verified_chain(3).