class
CycloneDX::Component
- CycloneDX::Component
- Reference
- Object
Overview
Represents a component in the CycloneDX Bill of Materials (BOM). This class is responsible for defining the structure and serialization of a software component, including its type, name, version, and PURL.
Included Modules
- JSON::Serializable
Defined in:
cyclonedx/component.crConstant Summary
-
DEFAULT_TYPE =
"library"
Constructors
-
.new(name : String, version : String, component_type : String = DEFAULT_TYPE, purl : String | Nil = nil, description : String | Nil = nil, author : String | Nil = nil, licenses : Array(License) | Nil = nil, external_references : Array(ExternalReference) | Nil = nil, bom_ref : String | Nil = nil, scope : String | Nil = nil, hashes : Array(Hash) | Nil = nil)
Initializes a new CycloneDX Component.
- .new(pull : JSON::PullParser)
Instance Method Summary
- #author : String | Nil
-
#bom_ref : String | Nil
A unique identifier for the component, used in dependency references.
-
#component_type : String
The type of the component (e.g., "library", "application").
- #description : String | Nil
- #external_references : Array(ExternalReference) | Nil
- #hashes : Array(Hash) | Nil
- #licenses : Array(License) | Nil
-
#name : String
The name of the component.
-
#purl : String | Nil
The Package URL (PURL) of the component, if available.
-
#scope : String | Nil
The scope of the component (e.g., "required", "optional", "excluded").
-
#to_xml(xml : XML::Builder) : Nil
Serializes the component to XML format.
-
#version : String
The version of the component.
Constructor Detail
def self.new(name : String, version : String, component_type : String = DEFAULT_TYPE, purl : String | Nil = nil, description : String | Nil = nil, author : String | Nil = nil, licenses : Array(License) | Nil = nil, external_references : Array(ExternalReference) | Nil = nil, bom_ref : String | Nil = nil, scope : String | Nil = nil, hashes : Array(Hash) | Nil = nil)
#
Initializes a new CycloneDX Component.