Find
the full path to the executable for gem name
. If the exec_name
is not given, the gem’s default_executable is chosen, otherwise the specified executable’s path is returned. requirements
allows you to specify specific gem versions.
Reset the dir
and path
values. The next time dir
or path
is requested, the values will be calculated from scratch. This is mainly used by the unit tests to provide test isolation.
The version of the Marshal
format for your Ruby.
Glob pattern for require-able path suffixes.
Use the home
and paths
values for Gem.dir
and Gem.path
. Used mainly by the unit tests to provide environment isolation.
Is this a windows platform?
Default gem load path
Default options for gem commands.
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.platform_defaults
{ 'install' => '--no-rdoc --no-ri --env-shebang', 'update' => '--no-rdoc --no-ri --env-shebang' }
end
Allows toggling Windows behavior. This method is available when requiring ‘rubygems/test_case’
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
@!visibility private
Creates a new DH
instance from scratch by generating the private and public components alike.
size
is an integer representing the desired key size. Keys smaller than 1024 bits should be considered insecure.
generator
is a small number > 1, typically 2 or 5.
Indicates whether this DH
instance has a private key associated with it or not. The private key may be retrieved with DH#priv_key.
A description of the current connection state. This is for diagnostic purposes only.