class
Purl::PackageURL
- Purl::PackageURL
- Reference
- Object
Overview
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/[email protected]"
Defined in:
purl/package_url.crConstant Summary
-
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)
-
.parse(purl_string : String) : PackageURL
Parses a Package URL string and returns a PackageURL instance.
Instance Method Summary
-
#==(other : PackageURL) : Bool
Equality comparison: two PackageURLs are equal if all normalized components match.
-
#hash(hasher)
See
Object#hash(hasher) - #name : String
- #namespace : String | Nil
- #qualifiers : Hash(String, String) | Nil
- #subpath : String | Nil
-
#to_s(io : IO) : Nil
Writes the Package URL in purl format directly to the given IO.
-
#to_s : String
Returns the Package URL as a string in the purl format.
- #type : String
- #version : String | Nil
Constructor Detail
Parses a Package URL string and returns a PackageURL instance.
Instance Method Detail
Equality comparison: two PackageURLs are equal if all normalized components match.