Class: SemgrepWebApp::Format

Inherits:
Object
  • Object
show all
Defined in:
lib/semgrep_web_app/models/format.rb

Overview

Format for the SBOM export. | value | description | |-------|---------------| | SBOM_FORMAT_CYCLONEDX | |

Constant Summary collapse

FORMAT =
[
  # TODO: Write general description for SBOM_FORMAT_CYCLONEDX
  SBOM_FORMAT_CYCLONEDX = 'SBOM_FORMAT_CYCLONEDX'.freeze
].freeze

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = SBOM_FORMAT_CYCLONEDX) ⇒ Object



21
22
23
24
25
# File 'lib/semgrep_web_app/models/format.rb', line 21

def self.from_value(value, default_value = SBOM_FORMAT_CYCLONEDX)
  return default_value if value.nil?

  default_value
end

.validate(value) ⇒ Object



15
16
17
18
19
# File 'lib/semgrep_web_app/models/format.rb', line 15

def self.validate(value)
  return false if value.nil?

  FORMAT.include?(value)
end