Represents writing to a constant in a context that doesn’t have an explicit value.
Foo, Bar = baz ^^^ ^^^
Represents reading a numbered reference to a capture in the previous match.
$1 ^^
Represents the use of the ‘undef` keyword.
undef :foo, :bar, :baz ^^^^^^^^^^^^^^^^^^^^^^
A cache that can be used to quickly compute code unit offsets from byte offsets. It purposefully provides only a single []
method to access the cache in order to minimize surface area.
Note that there are some known issues here that may or may not be addressed in the future:
The first is that there are issues when the cache computes values that are not on character boundaries. This can result in subsequent computations being off by one or more code units.
The second is that this cache is currently unbounded. In theory we could introduce some kind of LRU cache to limit the number of entries, but this has not yet been implemented.
Gem::ConfigFile
RubyGems options and gem command options from gemrc.
gemrc is a YAML
file that uses strings to match gem command arguments and symbols to match RubyGems options.
Gem
command arguments use a String
key that matches the command name and allow you to specify default arguments:
install: --no-rdoc --no-ri update: --no-rdoc --no-ri
You can use gem:
to set default arguments for all commands.
RubyGems options use symbol keys. Valid options are:
:backtrace
See backtrace
:sources
Sets Gem::sources
:verbose
See verbose
:concurrent_downloads
gemrc files may exist in various locations and are read and merged in the following order:
system wide (/etc/gemrc)
per user (~/.gemrc)
per environment (gemrc files listed in the GEMRC environment variable)
Installs a gem along with all its dependencies from local and remote gems.
Raised when removing a gem with the uninstall command fails
Raised by Gem::Resolver
when dependencies conflict and create the inability to find a valid possible spec for a request.
An Uninstaller
.
The uninstaller fires pre and post uninstall hooks. Hooks can be added either through a rubygems_plugin.rb file in an installed gem or via a rubygems/defaults/#{RUBY_ENGINE}.rb or rubygems/defaults/operating_system.rb file. See Gem.pre_uninstall
and Gem.post_uninstall
for details.
Subclass of StreamUI that instantiates the user interaction using $stdin, $stdout, and $stderr.
Turns a “invalid block(s)” into useful context
There are three main phases in the algorithm:
Sanitize/format input source
Search for invalid blocks
Format invalid blocks into something meaningful
This class handles the third part.
The algorithm is very good at capturing all of a syntax error in a single block in number 2, however the results can contain ambiguities. Humans are good at pattern matching and filtering and can mentally remove extraneous data, but they can’t add extra data that’s not present.
In the case of known ambiguious cases, this class adds context back to the ambiguity so the programmer has full information.
Beyond handling these ambiguities, it also captures surrounding code context information:
puts block.to_s # => "def bark" context = CaptureCodeContext.new( blocks: block, code_lines: code_lines ) lines = context.call.map(&:original) puts lines.join # => class Dog def bark end
Keeps track of what elements are in the queue in priority and also ensures that when one element engulfs/covers/eats another that the larger element evicts the smaller element
A special object which replaces any value that was moved to another ractor in Ractor#send
or Ractor.yield
. Any attempt to access the object results in Ractor::MovedError
.
r = Ractor.new { receive } ary = [1, 2, 3] r.send(ary, move: true) p Ractor::MovedObject === ary # => true ary.inspect # Ractor::MovedError (can not send any methods to a moved object)
Flags for nodes that have unescaped content.
Configuration options for dumping YAML
.
An optional node field represents a single child node in the syntax tree that may or may not be present. It resolves to either a Prism::Node
or nil in Ruby.
An InstalledSpecification
represents a gem that is already installed locally.
An error class raised when missing nodes are found while computing a constant path’s full name. For example:
-> raises because the constant path is missing the last part