Sha256: 441a06ea1037b90d93498e2959bb30002788f567aa72705448f85f4d4149da50
Contents?: true
Size: 1.19 KB
Versions: 3
Compression:
Stored size: 1.19 KB
Contents
# CVSS-Suite, a Ruby gem to manage the CVSS vector # # Copyright (c) Siemens AG, 2016 # # Authors: # Oliver Hambörger <oliver.hamboerger@siemens.com> # # This work is licensed under the terms of the MIT license. # See the LICENSE.md file in the top-level directory. module CvssSuite ## # This class represents any CVSS metric. class CvssMetric ## # Creates a new CVSS metric by +properties+ def initialize(selected_properties) @properties = [] init_properties extract_selected_values_from selected_properties end ## # Returns if the metric is valid. def valid? @properties.each do |property| return false unless property.valid? end true end ## # Returns number of properties for this metric. def count @properties.count end private def extract_selected_values_from(selected_properties) selected_properties.each do |selected_property| property = @properties.detect do |p| p.abbreviation == selected_property[:name] && p.position.include?(selected_property[:position]) end property&.set_selected_value selected_property[:selected] end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
cvss-suite-2.0.2 | lib/cvss_suite/cvss_metric.rb |
cvss-suite-2.0.1 | lib/cvss_suite/cvss_metric.rb |
cvss-suite-2.0.0 | lib/cvss_suite/cvss_metric.rb |