Class: CycloneDX::CocoaPods::BOMBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/cyclonedx/cocoapods/bom_builder.rb

Overview

Turns the internal model data into an XML bom.

Constant Summary collapse

NAMESPACE =
'http://cyclonedx.org/schema/bom/1.6'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(pods:, manifest_path:, component: nil, dependencies: nil, manufacturer: nil) ⇒ BOMBuilder

Returns a new instance of BOMBuilder.



344
345
346
347
348
349
350
# File 'lib/cyclonedx/cocoapods/bom_builder.rb', line 344

def initialize(pods:, manifest_path:, component: nil, dependencies: nil, manufacturer: nil)
  @pods = pods.sort_by(&:purl)
  @manifest_path = manifest_path
  @component = component
  @dependencies = dependencies&.sort
  @manufacturer = manufacturer
end

Instance Attribute Details

#componentObject (readonly)

Returns the value of attribute component.



342
343
344
# File 'lib/cyclonedx/cocoapods/bom_builder.rb', line 342

def component
  @component
end

#dependenciesObject (readonly)

Returns the value of attribute dependencies.



342
343
344
# File 'lib/cyclonedx/cocoapods/bom_builder.rb', line 342

def dependencies
  @dependencies
end

#manifest_pathObject (readonly)

Returns the value of attribute manifest_path.



342
343
344
# File 'lib/cyclonedx/cocoapods/bom_builder.rb', line 342

def manifest_path
  @manifest_path
end

#manufacturerObject (readonly)

Returns the value of attribute manufacturer.



342
343
344
# File 'lib/cyclonedx/cocoapods/bom_builder.rb', line 342

def manufacturer
  @manufacturer
end

#podsObject (readonly)

Returns the value of attribute pods.



342
343
344
# File 'lib/cyclonedx/cocoapods/bom_builder.rb', line 342

def pods
  @pods
end

Instance Method Details

#bom(version: 1, trim_strings_length: 0, format: :xml) ⇒ Object



352
353
354
355
356
357
358
# File 'lib/cyclonedx/cocoapods/bom_builder.rb', line 352

def bom(version: 1, trim_strings_length: 0, format: :xml)
  validate_version(version)
  validate_trim_length(trim_strings_length)
  validate_format(format)

  unchecked_bom(version: version, trim_strings_length: trim_strings_length, format: format)
end