Documentation ¶
Index ¶
- Variables
- type Collection
- type Constraints
- type Version
- func (v Version) Bump() Version
- func (v Version) Compare(other Version) int
- func (v Version) Equal(o Version) bool
- func (v Version) GreaterThan(o Version) bool
- func (v Version) GreaterThanOrEqual(o Version) bool
- func (v Version) LessThan(o Version) bool
- func (v Version) LessThanOrEqual(o Version) bool
- func (v Version) Release() Version
- func (v Version) String() string
Constants ¶
This section is empty.
Variables ¶
var ( // ErrInvalidSemVer is returned when a given version is invalid ErrInvalidVersion = xerrors.New("invalid gem version") )
Functions ¶
This section is empty.
Types ¶
type Collection ¶
type Collection []Version
Collection is a type that implements the sort.Interface interface so that versions can be sorted.
func (Collection) Len ¶
func (v Collection) Len() int
func (Collection) Less ¶
func (v Collection) Less(i, j int) bool
func (Collection) Swap ¶
func (v Collection) Swap(i, j int)
type Constraints ¶
type Constraints [][]constraint
Constraints is one or more constraint that a version can be checked against.
func NewConstraints ¶
func NewConstraints(v string) (Constraints, error)
NewConstraints parses a given constraint and returns a new instance of Constraints
func (Constraints) Check ¶
func (cs Constraints) Check(v Version) bool
Check tests if a version satisfies all the constraints.
func (Constraints) String ¶
func (cs Constraints) String() string
Returns the string format of the constraints
type Version ¶
type Version struct {
// contains filtered or unexported fields
}
func NewVersion ¶
NewVersion returns an instance of Version ref. https://github.com/rubygems/rubygems/blob/6914b4ec439ae1e7079b3c08576cb3fbce68aa69/lib/rubygems/version.rb#L212-L222
func (Version) Bump ¶
Bump returns a new version object where the next to the last revision number is one greater (e.g., 5.3.1 => 5.4). https://docs.ruby-lang.org/en/2.6.0/Gem/Version.html#method-i-release
func (Version) Compare ¶
Compare compares this version to another version. This returns -1, 0, or 1 if this version is smaller, equal, or larger than the other version, respectively.
func (Version) GreaterThan ¶
GreaterThan tests if this version is greater than another version.
func (Version) GreaterThanOrEqual ¶
GreaterThanOrEqual tests if this version is greater than or equal to another version.
func (Version) LessThanOrEqual ¶
LessThanOrEqual tests if this version is less than or equal to another version.
func (Version) Release ¶
Release returns the release for this version (e.g. 1.2.0.a -> 1.2.0). Non-prerelease versions return themselves. https://docs.ruby-lang.org/en/2.6.0/Gem/Version.html#method-i-release