class

Purl::PackageURL

Inherits Reference < Object

Represents a Package URL as defined by the purl specification (ECMA-427).

A Package URL is a URL string used to identify and locate a software package in a mostly universal and uniform way across programming languages.

Format: pkg:type/namespace/name@version?qualifiers#subpath

Example:

purl = Purl::PackageURL.new("npm", "@angular", "animation", "12.3.1")
purl.to_s # => "pkg:npm/%40angular/animation@12.3.1"

Constants

QUALIFIER_KEY_PATTERN = /^[a-z][a-z0-9._\-]*$/

Valid qualifier key pattern: starts with lowercase letter, contains only [a-z0-9._-]

SCHEME = "pkg"
TYPE_PATTERN = /^[a-zA-Z][a-zA-Z0-9.+\-]*$/

Valid type pattern: starts with letter, contains only [a-zA-Z0-9.+-]

Constructors

new(type : String, namespace : String | Nil, name : String, version : String | Nil = nil, qualifiers : Hash(String, String) | Nil = nil, subpath : String | Nil = nil)
Source
parse(purl_string : String) : PackageURL

Parses a Package URL string and returns a PackageURL instance.

Source

Instance methods

==(other : PackageURL) : Bool

Equality comparison: two PackageURLs are equal if all normalized components match.

Source
hash(hasher)

See Object#hash(hasher)

Source
name
Source
namespace
Source
qualifiers
Source
subpath
Source
to_s(io : IO) : Nil

Writes the Package URL in purl format directly to the given IO.

Source
to_s

Returns the Package URL as a string in the purl format.

Source
type
Source
version
Source