class CycloneDX::Component

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

Defined in:

cyclonedx/component.cr

Constant Summary

DEFAULT_TYPE = "library"

Constructors

Instance Method Summary

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.


[View source]
def self.new(pull : JSON::PullParser) #

[View source]

Instance Method Detail

def author : String | Nil #

[View source]
def bom_ref : String | Nil #

A unique identifier for the component, used in dependency references.


[View source]
def component_type : String #

The type of the component (e.g., "library", "application").


[View source]
def description : String | Nil #

[View source]
def external_references : Array(ExternalReference) | Nil #

[View source]
def hashes : Array(Hash) | Nil #

[View source]
def licenses : Array(License) | Nil #

[View source]
def name : String #

The name of the component.


[View source]
def purl : String | Nil #

The Package URL (PURL) of the component, if available.


[View source]
def scope : String | Nil #

The scope of the component (e.g., "required", "optional", "excluded").


[View source]
def to_xml(xml : XML::Builder) : Nil #

Serializes the component to XML format.


[View source]
def version : String #

The version of the component.


[View source]