Class: SemgrepWebApp::ProductType
- Inherits:
-
Object
- Object
- SemgrepWebApp::ProductType
- Defined in:
- lib/semgrep_web_app/models/product_type.rb
Overview
Product type the Policy applies to. | value | description | |-------|---------------| | PRODUCT_TYPE_SAST | The product type for Code rules. | | PRODUCT_TYPE_SECRETS | The product type for Secrets rules. |
Constant Summary collapse
- PRODUCT_TYPE =
[ # TODO: Write general description for PRODUCT_TYPE_SAST PRODUCT_TYPE_SAST = 'PRODUCT_TYPE_SAST'.freeze, # TODO: Write general description for PRODUCT_TYPE_SECRETS PRODUCT_TYPE_SECRETS = 'PRODUCT_TYPE_SECRETS'.freeze ].freeze
Class Method Summary collapse
Class Method Details
.from_value(value, default_value = PRODUCT_TYPE_SAST) ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/semgrep_web_app/models/product_type.rb', line 25 def self.from_value(value, default_value = PRODUCT_TYPE_SAST) return default_value if value.nil? str = value.to_s.strip case str.downcase when 'product_type_sast' then PRODUCT_TYPE_SAST when 'product_type_secrets' then PRODUCT_TYPE_SECRETS else default_value end end |
.validate(value) ⇒ Object
19 20 21 22 23 |
# File 'lib/semgrep_web_app/models/product_type.rb', line 19 def self.validate(value) return false if value.nil? PRODUCT_TYPE.include?(value) end |