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

Constructors

Instance Method Summary

Constructor Detail

def self.new(name : String, version : String, component_type : String = "library", purl : Nil | String = nil) #

Initializes a new CycloneDX Component.

@param name [String] The name of the component. @param version [String] The version of the component. @param component_type [String] The type of the component (default: "library"). @param purl [String?] The PURL of the component (default: nil).


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

[View source]

Instance Method Detail

def component_type : String #

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


[View source]
def component_type=(component_type : String) #

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


[View source]
def name : String #

The name of the component.


[View source]
def name=(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 purl=(purl : String | Nil) #

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


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

Serializes the component to XML format.

@param builder [XML::Builder] The XML builder instance.


[View source]
def version : String #

The version of the component.


[View source]
def version=(version : String) #

The version of the component.


[View source]