Class: Sarif::ToolComponent
- Inherits:
-
Object
- Object
- Sarif::ToolComponent
- Defined in:
- lib/sarif/tool_component.rb
Overview
A component, such as a plug-in or the driver, of the analysis tool that was run.
Instance Attribute Summary collapse
-
#associated_component ⇒ Object
Returns the value of attribute associated_component.
-
#contents ⇒ Object
Returns the value of attribute contents.
-
#dotted_quad_file_version ⇒ Object
Returns the value of attribute dotted_quad_file_version.
-
#download_uri ⇒ Object
Returns the value of attribute download_uri.
-
#full_description ⇒ Object
Returns the value of attribute full_description.
-
#full_name ⇒ Object
Returns the value of attribute full_name.
-
#global_message_strings ⇒ Object
Returns the value of attribute global_message_strings.
-
#guid ⇒ Object
Returns the value of attribute guid.
-
#information_uri ⇒ Object
Returns the value of attribute information_uri.
-
#is_comprehensive ⇒ Object
Returns the value of attribute is_comprehensive.
-
#language ⇒ Object
Returns the value of attribute language.
-
#localized_data_semantic_version ⇒ Object
Returns the value of attribute localized_data_semantic_version.
-
#locations ⇒ Object
Returns the value of attribute locations.
-
#minimum_required_localized_data_semantic_version ⇒ Object
Returns the value of attribute minimum_required_localized_data_semantic_version.
-
#name ⇒ Object
Returns the value of attribute name.
-
#notifications ⇒ Object
Returns the value of attribute notifications.
-
#organization ⇒ Object
Returns the value of attribute organization.
-
#product ⇒ Object
Returns the value of attribute product.
-
#product_suite ⇒ Object
Returns the value of attribute product_suite.
-
#properties ⇒ Object
Returns the value of attribute properties.
-
#release_date_utc ⇒ Object
Returns the value of attribute release_date_utc.
-
#rules ⇒ Object
Returns the value of attribute rules.
-
#semantic_version ⇒ Object
Returns the value of attribute semantic_version.
-
#short_description ⇒ Object
Returns the value of attribute short_description.
-
#supported_taxonomies ⇒ Object
Returns the value of attribute supported_taxonomies.
-
#taxa ⇒ Object
Returns the value of attribute taxa.
-
#translation_metadata ⇒ Object
Returns the value of attribute translation_metadata.
-
#version ⇒ Object
Returns the value of attribute version.
Class Method Summary collapse
Instance Method Summary collapse
- #==(other) ⇒ Object (also: #eql?)
- #hash ⇒ Object
-
#initialize(guid: nil, name:, organization: nil, product: nil, product_suite: nil, short_description: nil, full_description: nil, full_name: nil, version: nil, semantic_version: nil, dotted_quad_file_version: nil, release_date_utc: nil, download_uri: nil, information_uri: nil, global_message_strings: nil, notifications: [], rules: [], taxa: [], locations: [], language: "en-US", contents: ["localizedData", "nonLocalizedData"], is_comprehensive: false, localized_data_semantic_version: nil, minimum_required_localized_data_semantic_version: nil, associated_component: nil, translation_metadata: nil, supported_taxonomies: [], properties: nil) ⇒ ToolComponent
constructor
A new instance of ToolComponent.
- #to_h ⇒ Object
- #to_json(pretty: false) ⇒ Object
Constructor Details
#initialize(guid: nil, name:, organization: nil, product: nil, product_suite: nil, short_description: nil, full_description: nil, full_name: nil, version: nil, semantic_version: nil, dotted_quad_file_version: nil, release_date_utc: nil, download_uri: nil, information_uri: nil, global_message_strings: nil, notifications: [], rules: [], taxa: [], locations: [], language: "en-US", contents: ["localizedData", "nonLocalizedData"], is_comprehensive: false, localized_data_semantic_version: nil, minimum_required_localized_data_semantic_version: nil, associated_component: nil, translation_metadata: nil, supported_taxonomies: [], properties: nil) ⇒ ToolComponent
Returns a new instance of ToolComponent.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/sarif/tool_component.rb', line 8 def initialize(guid: nil, name:, organization: nil, product: nil, product_suite: nil, short_description: nil, full_description: nil, full_name: nil, version: nil, semantic_version: nil, dotted_quad_file_version: nil, release_date_utc: nil, download_uri: nil, information_uri: nil, global_message_strings: nil, notifications: [], rules: [], taxa: [], locations: [], language: "en-US", contents: ["localizedData", "nonLocalizedData"], is_comprehensive: false, localized_data_semantic_version: nil, minimum_required_localized_data_semantic_version: nil, associated_component: nil, translation_metadata: nil, supported_taxonomies: [], properties: nil) @guid = guid @name = name @organization = organization @product = product @product_suite = product_suite @short_description = short_description @full_description = full_description @full_name = full_name @version = version @semantic_version = semantic_version @dotted_quad_file_version = dotted_quad_file_version @release_date_utc = release_date_utc @download_uri = download_uri @information_uri = information_uri @global_message_strings = @notifications = notifications @rules = rules @taxa = taxa @locations = locations @language = language @contents = contents @is_comprehensive = is_comprehensive @localized_data_semantic_version = localized_data_semantic_version @minimum_required_localized_data_semantic_version = minimum_required_localized_data_semantic_version @associated_component = associated_component @translation_metadata = @supported_taxonomies = supported_taxonomies @properties = properties end |
Instance Attribute Details
#associated_component ⇒ Object
Returns the value of attribute associated_component.
6 7 8 |
# File 'lib/sarif/tool_component.rb', line 6 def associated_component @associated_component end |
#contents ⇒ Object
Returns the value of attribute contents.
6 7 8 |
# File 'lib/sarif/tool_component.rb', line 6 def contents @contents end |
#dotted_quad_file_version ⇒ Object
Returns the value of attribute dotted_quad_file_version.
6 7 8 |
# File 'lib/sarif/tool_component.rb', line 6 def dotted_quad_file_version @dotted_quad_file_version end |
#download_uri ⇒ Object
Returns the value of attribute download_uri.
6 7 8 |
# File 'lib/sarif/tool_component.rb', line 6 def download_uri @download_uri end |
#full_description ⇒ Object
Returns the value of attribute full_description.
6 7 8 |
# File 'lib/sarif/tool_component.rb', line 6 def full_description @full_description end |
#full_name ⇒ Object
Returns the value of attribute full_name.
6 7 8 |
# File 'lib/sarif/tool_component.rb', line 6 def full_name @full_name end |
#global_message_strings ⇒ Object
Returns the value of attribute global_message_strings.
6 7 8 |
# File 'lib/sarif/tool_component.rb', line 6 def @global_message_strings end |
#guid ⇒ Object
Returns the value of attribute guid.
6 7 8 |
# File 'lib/sarif/tool_component.rb', line 6 def guid @guid end |
#information_uri ⇒ Object
Returns the value of attribute information_uri.
6 7 8 |
# File 'lib/sarif/tool_component.rb', line 6 def information_uri @information_uri end |
#is_comprehensive ⇒ Object
Returns the value of attribute is_comprehensive.
6 7 8 |
# File 'lib/sarif/tool_component.rb', line 6 def is_comprehensive @is_comprehensive end |
#language ⇒ Object
Returns the value of attribute language.
6 7 8 |
# File 'lib/sarif/tool_component.rb', line 6 def language @language end |
#localized_data_semantic_version ⇒ Object
Returns the value of attribute localized_data_semantic_version.
6 7 8 |
# File 'lib/sarif/tool_component.rb', line 6 def localized_data_semantic_version @localized_data_semantic_version end |
#locations ⇒ Object
Returns the value of attribute locations.
6 7 8 |
# File 'lib/sarif/tool_component.rb', line 6 def locations @locations end |
#minimum_required_localized_data_semantic_version ⇒ Object
Returns the value of attribute minimum_required_localized_data_semantic_version.
6 7 8 |
# File 'lib/sarif/tool_component.rb', line 6 def minimum_required_localized_data_semantic_version @minimum_required_localized_data_semantic_version end |
#name ⇒ Object
Returns the value of attribute name.
6 7 8 |
# File 'lib/sarif/tool_component.rb', line 6 def name @name end |
#notifications ⇒ Object
Returns the value of attribute notifications.
6 7 8 |
# File 'lib/sarif/tool_component.rb', line 6 def notifications @notifications end |
#organization ⇒ Object
Returns the value of attribute organization.
6 7 8 |
# File 'lib/sarif/tool_component.rb', line 6 def organization @organization end |
#product ⇒ Object
Returns the value of attribute product.
6 7 8 |
# File 'lib/sarif/tool_component.rb', line 6 def product @product end |
#product_suite ⇒ Object
Returns the value of attribute product_suite.
6 7 8 |
# File 'lib/sarif/tool_component.rb', line 6 def product_suite @product_suite end |
#properties ⇒ Object
Returns the value of attribute properties.
6 7 8 |
# File 'lib/sarif/tool_component.rb', line 6 def properties @properties end |
#release_date_utc ⇒ Object
Returns the value of attribute release_date_utc.
6 7 8 |
# File 'lib/sarif/tool_component.rb', line 6 def release_date_utc @release_date_utc end |
#rules ⇒ Object
Returns the value of attribute rules.
6 7 8 |
# File 'lib/sarif/tool_component.rb', line 6 def rules @rules end |
#semantic_version ⇒ Object
Returns the value of attribute semantic_version.
6 7 8 |
# File 'lib/sarif/tool_component.rb', line 6 def semantic_version @semantic_version end |
#short_description ⇒ Object
Returns the value of attribute short_description.
6 7 8 |
# File 'lib/sarif/tool_component.rb', line 6 def short_description @short_description end |
#supported_taxonomies ⇒ Object
Returns the value of attribute supported_taxonomies.
6 7 8 |
# File 'lib/sarif/tool_component.rb', line 6 def supported_taxonomies @supported_taxonomies end |
#taxa ⇒ Object
Returns the value of attribute taxa.
6 7 8 |
# File 'lib/sarif/tool_component.rb', line 6 def taxa @taxa end |
#translation_metadata ⇒ Object
Returns the value of attribute translation_metadata.
6 7 8 |
# File 'lib/sarif/tool_component.rb', line 6 def @translation_metadata end |
#version ⇒ Object
Returns the value of attribute version.
6 7 8 |
# File 'lib/sarif/tool_component.rb', line 6 def version @version end |
Class Method Details
.from_hash(h) ⇒ Object
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 |
# File 'lib/sarif/tool_component.rb', line 76 def self.from_hash(h) return nil if h.nil? new( guid: h["guid"], name: h["name"], organization: h["organization"], product: h["product"], product_suite: h["productSuite"], short_description: MultiformatMessageString.from_hash(h["shortDescription"]), full_description: MultiformatMessageString.from_hash(h["fullDescription"]), full_name: h["fullName"], version: h["version"], semantic_version: h["semanticVersion"], dotted_quad_file_version: h["dottedQuadFileVersion"], release_date_utc: h["releaseDateUtc"], download_uri: h["downloadUri"], information_uri: h["informationUri"], global_message_strings: h["globalMessageStrings"], notifications: h["notifications"]&.map { |v| ReportingDescriptor.from_hash(v) } || [], rules: h["rules"]&.map { |v| ReportingDescriptor.from_hash(v) } || [], taxa: h["taxa"]&.map { |v| ReportingDescriptor.from_hash(v) } || [], locations: h["locations"]&.map { |v| ArtifactLocation.from_hash(v) } || [], language: h["language"] || "en-US", contents: h.key?("contents") ? h["contents"] : ["localizedData", "nonLocalizedData"], is_comprehensive: h.key?("isComprehensive") ? h["isComprehensive"] : false, localized_data_semantic_version: h["localizedDataSemanticVersion"], minimum_required_localized_data_semantic_version: h["minimumRequiredLocalizedDataSemanticVersion"], associated_component: ToolComponentReference.from_hash(h["associatedComponent"]), translation_metadata: TranslationMetadata.from_hash(h["translationMetadata"]), supported_taxonomies: h["supportedTaxonomies"]&.map { |v| ToolComponentReference.from_hash(v) } || [], properties: h["properties"] ) end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
110 111 112 113 |
# File 'lib/sarif/tool_component.rb', line 110 def ==(other) return false unless other.is_a?(ToolComponent) @guid == other.guid && @name == other.name && @organization == other.organization && @product == other.product && @product_suite == other.product_suite && @short_description == other.short_description && @full_description == other.full_description && @full_name == other.full_name && @version == other.version && @semantic_version == other.semantic_version && @dotted_quad_file_version == other.dotted_quad_file_version && @release_date_utc == other.release_date_utc && @download_uri == other.download_uri && @information_uri == other.information_uri && @global_message_strings == other. && @notifications == other.notifications && @rules == other.rules && @taxa == other.taxa && @locations == other.locations && @language == other.language && @contents == other.contents && @is_comprehensive == other.is_comprehensive && @localized_data_semantic_version == other.localized_data_semantic_version && @minimum_required_localized_data_semantic_version == other.minimum_required_localized_data_semantic_version && @associated_component == other.associated_component && @translation_metadata == other. && @supported_taxonomies == other.supported_taxonomies && @properties == other.properties end |
#hash ⇒ Object
117 118 119 |
# File 'lib/sarif/tool_component.rb', line 117 def hash [@guid, @name, @organization, @product, @product_suite, @short_description, @full_description, @full_name, @version, @semantic_version, @dotted_quad_file_version, @release_date_utc, @download_uri, @information_uri, @global_message_strings, @notifications, @rules, @taxa, @locations, @language, @contents, @is_comprehensive, @localized_data_semantic_version, @minimum_required_localized_data_semantic_version, @associated_component, @translation_metadata, @supported_taxonomies, @properties].hash end |
#to_h ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/sarif/tool_component.rb', line 39 def to_h h = {} h["guid"] = @guid unless @guid.nil? h["name"] = @name h["organization"] = @organization unless @organization.nil? h["product"] = @product unless @product.nil? h["productSuite"] = @product_suite unless @product_suite.nil? h["shortDescription"] = @short_description&.to_h unless @short_description.nil? h["fullDescription"] = @full_description&.to_h unless @full_description.nil? h["fullName"] = @full_name unless @full_name.nil? h["version"] = @version unless @version.nil? h["semanticVersion"] = @semantic_version unless @semantic_version.nil? h["dottedQuadFileVersion"] = @dotted_quad_file_version unless @dotted_quad_file_version.nil? h["releaseDateUtc"] = @release_date_utc unless @release_date_utc.nil? h["downloadUri"] = @download_uri unless @download_uri.nil? h["informationUri"] = @information_uri unless @information_uri.nil? h["globalMessageStrings"] = @global_message_strings unless @global_message_strings.nil? h["notifications"] = @notifications&.map(&:to_h) if @notifications&.any? h["rules"] = @rules&.map(&:to_h) if @rules&.any? h["taxa"] = @taxa&.map(&:to_h) if @taxa&.any? h["locations"] = @locations&.map(&:to_h) if @locations&.any? h["language"] = @language if @language && @language != "en-US" h["contents"] = @contents&.map(&:to_s) if @contents&.any? h["isComprehensive"] = @is_comprehensive if @is_comprehensive h["localizedDataSemanticVersion"] = @localized_data_semantic_version unless @localized_data_semantic_version.nil? h["minimumRequiredLocalizedDataSemanticVersion"] = @minimum_required_localized_data_semantic_version unless @minimum_required_localized_data_semantic_version.nil? h["associatedComponent"] = @associated_component&.to_h unless @associated_component.nil? h["translationMetadata"] = @translation_metadata&.to_h unless @translation_metadata.nil? h["supportedTaxonomies"] = @supported_taxonomies&.map(&:to_h) if @supported_taxonomies&.any? h["properties"] = @properties unless @properties.nil? h end |
#to_json(pretty: false) ⇒ Object
72 73 74 |
# File 'lib/sarif/tool_component.rb', line 72 def to_json(pretty: false) pretty ? JSON.pretty_generate(to_h) : JSON.generate(to_h) end |