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)
Initializes a new CycloneDX Component.
- .new(pull : JSON::PullParser)
Instance Method Summary
-
#component_type : String
The type of the component (e.g., "library", "application").
-
#name : String
The name of the component.
-
#purl : String | Nil
The Package URL (PURL) of the component, if available.
-
#to_xml(builder : XML::Builder) : Nil
Serializes the component to XML format.
-
#version : String
The version of the component.
Constructor Detail
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).
Instance Method Detail
Serializes the component to XML format.
@param builder [XML::Builder] The XML builder instance.