The SourceSet
chooses the best available method to query a remote index.
Kind off like BestSet but filters the sources for gems
The Resolver::SpecSpecification contains common functionality for Resolver specifications that are backed by a Gem::Specification
.
A Resolver::Specification contains a subset of the information contained in a Gem::Specification
. Only the information necessary for dependency resolution in the resolver is included.
A VendorSpecification
represents a gem that has been unpacked into a project and is being loaded through a gem dependencies file through the path:
option.
Gem::Security
default exception type
A source representing a single .gem file. This is used for installation of local gems.
An absolutely silent IO
.
Common implementation for SVCB-compatible resource records.
The parser gem has a list of diagnostics with a hard-coded set of error messages. We create our own diagnostic class in order to set our own error messages.
A generic resource abstract class.
Error raised when no cdylib artifact was created
Converts Ruby
link flags into something cargo understands
Removes and returns elements from self
.
With numeric argument index
given, removes and returns the element at offset index
:
a = ['a', 'b', 'c', 'd'] a.slice!(2) # => "c" a # => ["a", "b", "d"] a.slice!(2.1) # => "d" a # => ["a", "b"]
If index
is negative, counts backwards from the end of self
:
a = ['a', 'b', 'c', 'd'] a.slice!(-2) # => "c" a # => ["a", "b", "d"]
If index
is out of range, returns nil
.
With numeric arguments start
and length
given, removes length
elements from self
beginning at zero-based offset start
; returns the removed objects in a new array:
a = ['a', 'b', 'c', 'd'] a.slice!(1, 2) # => ["b", "c"] a # => ["a", "d"] a.slice!(0.1, 1.1) # => ["a"] a # => ["d"]
If start
is negative, counts backwards from the end of self
:
a = ['a', 'b', 'c', 'd'] a.slice!(-2, 1) # => ["c"] a # => ["a", "b", "d"]
If start
is out-of-range, returns nil
:
a = ['a', 'b', 'c', 'd'] a.slice!(5, 1) # => nil a.slice!(-5, 1) # => nil
If start + length
exceeds the array size, removes and returns all elements from offset start
to the end:
a = ['a', 'b', 'c', 'd'] a.slice!(2, 50) # => ["c", "d"] a # => ["a", "b"]
If start == a.size
and length
is non-negative, returns a new empty array.
If length
is negative, returns nil
.
With Range
argument range
given, treats range.min
as start
(as above) and range.size
as length
(as above):
a = ['a', 'b', 'c', 'd'] a.slice!(1..2) # => ["b", "c"] a # => ["a", "d"]
If range.start == a.size
, returns a new empty array:
a = ['a', 'b', 'c', 'd'] a.slice!(4..5) # => []
If range.start
is larger than the array size, returns nil
:
a = ['a', 'b', 'c', 'd'] a.slice!(5..6) # => nil
If range.start
is negative, calculates the start index by counting backwards from the end of self
:
a = ['a', 'b', 'c', 'd'] a.slice!(-2..2) # => ["c"]
If range.end
is negative, calculates the end index by counting backwards from the end of self
:
a = ['a', 'b', 'c', 'd'] a.slice!(0..-2) # => ["a", "b", "c"]
Related: see Methods for Deleting.
Removes and returns the substring of self
specified by the arguments. See String Slices.
A few examples:
string = "This is a string" string.slice!(2) #=> "i" string.slice!(3..6) #=> " is " string.slice!(/s.*t/) #=> "sa st" string.slice!("r") #=> "r" string #=> "Thing"
Returns a substring of self
, or nil
if the substring cannot be constructed.
With integer arguments index
and length
given, returns the substring beginning at the given index
of the given length
(if possible), or nil
if length
is negative or index
falls outside of self
:
s = '0123456789' # => "0123456789" s.byteslice(2) # => "2" s.byteslice(200) # => nil s.byteslice(4, 3) # => "456" s.byteslice(4, 30) # => "456789" s.byteslice(4, -1) # => nil s.byteslice(40, 2) # => nil
In either case above, counts backwards from the end of self
if index
is negative:
s = '0123456789' # => "0123456789" s.byteslice(-4) # => "6" s.byteslice(-4, 3) # => "678"
With Range
argument range
given, returns byteslice(range.begin, range.size)
:
s = '0123456789' # => "0123456789" s.byteslice(4..6) # => "456" s.byteslice(-6..-4) # => "456" s.byteslice(5..2) # => "" # range.size is zero. s.byteslice(40..42) # => nil
In all cases, a returned string has the same encoding as self
:
s.encoding # => #<Encoding:UTF-8> s.byteslice(4).encoding # => #<Encoding:UTF-8>
Replaces some or all of the content of self
with str
, and returns self
. The portion of the string affected is determined using the same criteria as String#byteslice
, except that length
cannot be omitted. If the replacement string is not the same length as the text it is replacing, the string will be adjusted accordingly.
If str_index
and str_length
, or str_range
are given, the content of self
is replaced by str.byteslice(str_index, str_length) or str.byteslice(str_range); however the substring of str
is not allocated as a new string.
The form that take an Integer
will raise an IndexError
if the value is out of range; the Range
form will raise a RangeError
. If the beginning or ending offset does not land on character (codepoint) boundary, an IndexError
will be raised.