Class: Gitlab::Ci::Reports::Security::Flag
- Inherits:
-
Object
- Object
- Gitlab::Ci::Reports::Security::Flag
- Defined in:
- lib/gitlab/ci/reports/security/flag.rb
Constant Summary collapse
- MAP =
{ 'flagged-as-likely-false-positive' => :false_positive }.freeze
- DEFAULT_FLAG_TYPE =
:false_positive
Instance Attribute Summary collapse
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#origin ⇒ Object
readonly
Returns the value of attribute origin.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
- #false_positive? ⇒ Boolean
- #flag_type ⇒ Object
-
#initialize(type: nil, origin: nil, description: nil) ⇒ Flag
constructor
A new instance of Flag.
- #to_h ⇒ Object
Constructor Details
#initialize(type: nil, origin: nil, description: nil) ⇒ Flag
Returns a new instance of Flag.
17 18 19 20 21 |
# File 'lib/gitlab/ci/reports/security/flag.rb', line 17 def initialize(type: nil, origin: nil, description: nil) @type = type @origin = origin @description = description end |
Instance Attribute Details
#description ⇒ Object (readonly)
Returns the value of attribute description.
8 9 10 |
# File 'lib/gitlab/ci/reports/security/flag.rb', line 8 def description @description end |
#origin ⇒ Object (readonly)
Returns the value of attribute origin.
8 9 10 |
# File 'lib/gitlab/ci/reports/security/flag.rb', line 8 def origin @origin end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
8 9 10 |
# File 'lib/gitlab/ci/reports/security/flag.rb', line 8 def type @type end |
Instance Method Details
#false_positive? ⇒ Boolean
31 32 33 |
# File 'lib/gitlab/ci/reports/security/flag.rb', line 31 def false_positive? flag_type == :false_positive end |
#flag_type ⇒ Object
13 14 15 |
# File 'lib/gitlab/ci/reports/security/flag.rb', line 13 def flag_type MAP.fetch(type, DEFAULT_FLAG_TYPE) end |
#to_h ⇒ Object
23 24 25 26 27 28 29 |
# File 'lib/gitlab/ci/reports/security/flag.rb', line 23 def to_h { flag_type: flag_type, origin: origin, description: description }.compact end |