Class: Sarif::ReportingDescriptorReference
- Inherits:
-
Object
- Object
- Sarif::ReportingDescriptorReference
- Defined in:
- lib/sarif/reporting_descriptor_reference.rb
Overview
Information about how to locate a relevant reporting descriptor.
Instance Attribute Summary collapse
-
#guid ⇒ Object
Returns the value of attribute guid.
-
#id ⇒ Object
Returns the value of attribute id.
-
#index ⇒ Object
Returns the value of attribute index.
-
#properties ⇒ Object
Returns the value of attribute properties.
-
#tool_component ⇒ Object
Returns the value of attribute tool_component.
Class Method Summary collapse
Instance Method Summary collapse
- #==(other) ⇒ Object (also: #eql?)
- #hash ⇒ Object
-
#initialize(id: nil, index: -1,, guid: nil, tool_component: nil, properties: nil) ⇒ ReportingDescriptorReference
constructor
A new instance of ReportingDescriptorReference.
- #to_h ⇒ Object
- #to_json(pretty: false) ⇒ Object
Constructor Details
#initialize(id: nil, index: -1,, guid: nil, tool_component: nil, properties: nil) ⇒ ReportingDescriptorReference
Returns a new instance of ReportingDescriptorReference.
8 9 10 11 12 13 14 |
# File 'lib/sarif/reporting_descriptor_reference.rb', line 8 def initialize(id: nil, index: -1, guid: nil, tool_component: nil, properties: nil) @id = id @index = index @guid = guid @tool_component = tool_component @properties = properties end |
Instance Attribute Details
#guid ⇒ Object
Returns the value of attribute guid.
6 7 8 |
# File 'lib/sarif/reporting_descriptor_reference.rb', line 6 def guid @guid end |
#id ⇒ Object
Returns the value of attribute id.
6 7 8 |
# File 'lib/sarif/reporting_descriptor_reference.rb', line 6 def id @id end |
#index ⇒ Object
Returns the value of attribute index.
6 7 8 |
# File 'lib/sarif/reporting_descriptor_reference.rb', line 6 def index @index end |
#properties ⇒ Object
Returns the value of attribute properties.
6 7 8 |
# File 'lib/sarif/reporting_descriptor_reference.rb', line 6 def properties @properties end |
#tool_component ⇒ Object
Returns the value of attribute tool_component.
6 7 8 |
# File 'lib/sarif/reporting_descriptor_reference.rb', line 6 def tool_component @tool_component end |
Class Method Details
.from_hash(h) ⇒ Object
30 31 32 33 34 35 36 37 38 39 |
# File 'lib/sarif/reporting_descriptor_reference.rb', line 30 def self.from_hash(h) return nil if h.nil? new( id: h["id"], index: h["index"] || -1, guid: h["guid"], tool_component: ToolComponentReference.from_hash(h["toolComponent"]), properties: h["properties"] ) end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
41 42 43 44 |
# File 'lib/sarif/reporting_descriptor_reference.rb', line 41 def ==(other) return false unless other.is_a?(ReportingDescriptorReference) @id == other.id && @index == other.index && @guid == other.guid && @tool_component == other.tool_component && @properties == other.properties end |
#hash ⇒ Object
48 49 50 |
# File 'lib/sarif/reporting_descriptor_reference.rb', line 48 def hash [@id, @index, @guid, @tool_component, @properties].hash end |
#to_h ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'lib/sarif/reporting_descriptor_reference.rb', line 16 def to_h h = {} h["id"] = @id unless @id.nil? h["index"] = @index if @index && @index != -1 h["guid"] = @guid unless @guid.nil? h["toolComponent"] = @tool_component&.to_h unless @tool_component.nil? h["properties"] = @properties unless @properties.nil? h end |
#to_json(pretty: false) ⇒ Object
26 27 28 |
# File 'lib/sarif/reporting_descriptor_reference.rb', line 26 def to_json(pretty: false) pretty ? JSON.pretty_generate(to_h) : JSON.generate(to_h) end |