Class: Gitlab::Ci::Reports::Sbom::Component
- Inherits:
-
Object
- Object
- Gitlab::Ci::Reports::Sbom::Component
- Includes:
- Utils::StrongMemoize
- Defined in:
- lib/gitlab/ci/reports/sbom/component.rb
Instance Attribute Summary collapse
-
#component_type ⇒ Object
readonly
Returns the value of attribute component_type.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#version ⇒ Object
readonly
Returns the value of attribute version.
Instance Method Summary collapse
- #<=>(other) ⇒ Object
- #ingestible? ⇒ Boolean
-
#initialize(type:, name:, purl:, version:) ⇒ Component
constructor
A new instance of Component.
- #key ⇒ Object
- #name ⇒ Object
- #purl ⇒ Object
- #purl_type ⇒ Object
- #type ⇒ Object
Constructor Details
#initialize(type:, name:, purl:, version:) ⇒ Component
Returns a new instance of Component.
12 13 14 15 16 17 |
# File 'lib/gitlab/ci/reports/sbom/component.rb', line 12 def initialize(type:, name:, purl:, version:) @component_type = type @name = name @raw_purl = purl @version = version end |
Instance Attribute Details
#component_type ⇒ Object (readonly)
Returns the value of attribute component_type.
10 11 12 |
# File 'lib/gitlab/ci/reports/sbom/component.rb', line 10 def component_type @component_type end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
10 11 12 |
# File 'lib/gitlab/ci/reports/sbom/component.rb', line 10 def path @path end |
#version ⇒ Object (readonly)
Returns the value of attribute version.
10 11 12 |
# File 'lib/gitlab/ci/reports/sbom/component.rb', line 10 def version @version end |
Instance Method Details
#<=>(other) ⇒ Object
19 20 21 |
# File 'lib/gitlab/ci/reports/sbom/component.rb', line 19 def <=>(other) sort_by_attributes(self) <=> sort_by_attributes(other) end |
#ingestible? ⇒ Boolean
23 24 25 |
# File 'lib/gitlab/ci/reports/sbom/component.rb', line 23 def ingestible? supported_component_type? && supported_purl_type? end |
#key ⇒ Object
48 49 50 |
# File 'lib/gitlab/ci/reports/sbom/component.rb', line 48 def key [name, version, purl&.type] end |
#name ⇒ Object
42 43 44 45 46 |
# File 'lib/gitlab/ci/reports/sbom/component.rb', line 42 def name return @name unless purl [purl.namespace, purl.name].compact.join('/') end |
#purl ⇒ Object
27 28 29 30 31 |
# File 'lib/gitlab/ci/reports/sbom/component.rb', line 27 def purl return unless @raw_purl ::Sbom::PackageUrl.parse(@raw_purl) end |
#purl_type ⇒ Object
34 35 36 |
# File 'lib/gitlab/ci/reports/sbom/component.rb', line 34 def purl_type purl.type end |
#type ⇒ Object
38 39 40 |
# File 'lib/gitlab/ci/reports/sbom/component.rb', line 38 def type component_type end |