Results for: "Dir.chdir"

No documentation available

Performs various checks before installing the gem such as the install repository is writable and its directories exist, required Ruby and rubygems versions are met and that dependencies are installed.

Version and dependency checks are skipped if this install is forced.

The dependent check will be skipped if the install is ignoring dependencies.

Writes the .gem file to the cache directory

Given a name and requirement, downloads this gem into cache and returns the filename. Returns nil if the gem cannot be located.

Downloads uri to path if necessary. If no path is given, it just passes the data.

Extracts S3 configuration for S3 bucket

Find and fetch gem name tuples that match dependency.

If matching_platform is false, gems for all platforms are returned.

@return true if the specs of any default gems are ‘==` to the given `spec`.

Choose from a list of options. question is a prompt displayed above the list. list is a list of option strings. Returns the pair [option_name, option_index].

Performance optimization

Parsing with ripper is expensive If we know we don’t have any blocks with invalid syntax, then we know we cannot have found the incorrect syntax yet.

When an invalid block is added onto the frontier check document state

No documentation available

Builds blocks from bottom up

No documentation available

Calls the block with each capitalized field name:

res = Net::HTTP.get_response(hostname, '/todos/1')
res.each_capitalized_name do |key|
  p key if key.start_with?('C')
end

Output:

"Content-Type"
"Connection"
"Cache-Control"
"Cf-Cache-Status"
"Cf-Ray"

The capitalization is system-dependent; see Case Mapping.

Returns an enumerator if no block is given.

Check whether the object_id id is in the current buffer of objects to be pretty printed. Used to break cycles in chains of objects to be pretty printed.

No documentation available
No documentation available

Asks the user to answer question with an answer from the given list.

MRI specific feature

Return all reachable objects from root.

If the SOURCE_DATE_EPOCH environment variable is set, returns it’s value. Otherwise, returns the time that Gem.source_date_epoch_string was first called in the same format as SOURCE_DATE_EPOCH.

NOTE(@duckinator): The implementation is a tad weird because we want to:

1. Make builds reproducible by default, by having this function always
   return the same result during a given run.
2. Allow changing ENV['SOURCE_DATE_EPOCH'] at runtime, since multiple
   tests that set this variable will be run in a single process.

If you simplify this function and a lot of tests fail, that is likely due to #2 above.

Details on SOURCE_DATE_EPOCH: reproducible-builds.org/specs/source-date-epoch/

The iterator version of the strongly_connected_components method. obj.each_strongly_connected_component is similar to obj.strongly_connected_components.each, but modification of obj during the iteration may lead to unexpected results.

each_strongly_connected_component returns nil.

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.each_strongly_connected_component {|scc| p scc }
#=> [4]
#   [2]
#   [3]
#   [1]

graph = G.new({1=>[2], 2=>[3, 4], 3=>[2], 4=>[]})
graph.each_strongly_connected_component {|scc| p scc }
#=> [4]
#   [2, 3]
#   [1]

The iterator version of the TSort.strongly_connected_components 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.each_strongly_connected_component(each_node, each_child) {|scc| p scc }
#=> [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) }
TSort.each_strongly_connected_component(each_node, each_child) {|scc| p scc }
#=> [4]
#   [2, 3]
#   [1]

The parser gem automatically converts rn to n, meaning our offsets need to be adjusted to always subtract 1 from the length.

No documentation available

The current session cache mode.

Search took: 4ms  ·  Total Results: 1022