Class: Sarif::Suppression
- Inherits:
-
Object
- Object
- Sarif::Suppression
- Defined in:
- lib/sarif/suppression.rb
Overview
A suppression that is relevant to a result.
Instance Attribute Summary collapse
-
#guid ⇒ Object
Returns the value of attribute guid.
-
#justification ⇒ Object
Returns the value of attribute justification.
-
#kind ⇒ Object
Returns the value of attribute kind.
-
#location ⇒ Object
Returns the value of attribute location.
-
#properties ⇒ Object
Returns the value of attribute properties.
-
#status ⇒ Object
Returns the value of attribute status.
Class Method Summary collapse
Instance Method Summary collapse
- #==(other) ⇒ Object (also: #eql?)
- #hash ⇒ Object
-
#initialize(guid: nil, kind:, status: nil, justification: nil, location: nil, properties: nil) ⇒ Suppression
constructor
A new instance of Suppression.
- #to_h ⇒ Object
- #to_json(pretty: false) ⇒ Object
Constructor Details
#initialize(guid: nil, kind:, status: nil, justification: nil, location: nil, properties: nil) ⇒ Suppression
Returns a new instance of Suppression.
8 9 10 11 12 13 14 15 |
# File 'lib/sarif/suppression.rb', line 8 def initialize(guid: nil, kind:, status: nil, justification: nil, location: nil, properties: nil) @guid = guid @kind = kind @status = status @justification = justification @location = location @properties = properties end |
Instance Attribute Details
#guid ⇒ Object
Returns the value of attribute guid.
6 7 8 |
# File 'lib/sarif/suppression.rb', line 6 def guid @guid end |
#justification ⇒ Object
Returns the value of attribute justification.
6 7 8 |
# File 'lib/sarif/suppression.rb', line 6 def justification @justification end |
#kind ⇒ Object
Returns the value of attribute kind.
6 7 8 |
# File 'lib/sarif/suppression.rb', line 6 def kind @kind end |
#location ⇒ Object
Returns the value of attribute location.
6 7 8 |
# File 'lib/sarif/suppression.rb', line 6 def location @location end |
#properties ⇒ Object
Returns the value of attribute properties.
6 7 8 |
# File 'lib/sarif/suppression.rb', line 6 def properties @properties end |
#status ⇒ Object
Returns the value of attribute status.
6 7 8 |
# File 'lib/sarif/suppression.rb', line 6 def status @status end |
Class Method Details
.from_hash(h) ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/sarif/suppression.rb', line 32 def self.from_hash(h) return nil if h.nil? new( guid: h["guid"], kind: h["kind"], status: h["status"], justification: h["justification"], location: Location.from_hash(h["location"]), properties: h["properties"] ) end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
44 45 46 47 |
# File 'lib/sarif/suppression.rb', line 44 def ==(other) return false unless other.is_a?(Suppression) @guid == other.guid && @kind == other.kind && @status == other.status && @justification == other.justification && @location == other.location && @properties == other.properties end |
#hash ⇒ Object
51 52 53 |
# File 'lib/sarif/suppression.rb', line 51 def hash [@guid, @kind, @status, @justification, @location, @properties].hash end |
#to_h ⇒ Object
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/sarif/suppression.rb', line 17 def to_h h = {} h["guid"] = @guid unless @guid.nil? h["kind"] = @kind&.to_s h["status"] = @status&.to_s unless @status.nil? h["justification"] = @justification unless @justification.nil? h["location"] = @location&.to_h unless @location.nil? h["properties"] = @properties unless @properties.nil? h end |
#to_json(pretty: false) ⇒ Object
28 29 30 |
# File 'lib/sarif/suppression.rb', line 28 def to_json(pretty: false) pretty ? JSON.pretty_generate(to_h) : JSON.generate(to_h) end |