Sha256: 26706d01600af4c0cb3324740ef9437a185ddff98866edd3369dfeab7ff09c04

Contents?: true

Size: 761 Bytes

Versions: 4

Compression:

Stored size: 761 Bytes

Contents

# CVSS-Suite, a Ruby gem to manage the CVSS vector
#
# Copyright (c) 2016-2022 Siemens AG
# Copyright (c) 2022 0llirocks
#
# Authors:
#   0llirocks <http://0lli.rocks>
#
# This work is licensed under the terms of the MIT license.
# See the LICENSE.md file in the top-level directory.

module CvssSuite
  ##
  # This module includes methods which are used by the CVSS 3 classes.
  module Cvss31Helper
    ##
    # Since CVSS 3 all float values are rounded up, therefore this method is used
    # instead of the mathematically correct method round().
    def self.round_up(float)
      output = (float * 100_000).round
      if (output % 10_000).zero?
        output / 100_000.0
      else
        ((output / 10_000).floor + 1) / 10.0
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
cvss-suite-3.1.1 lib/cvss_suite/helpers/cvss31_helper.rb
cvss-suite-3.1.0 lib/cvss_suite/helpers/cvss31_helper.rb
cvss-suite-3.0.1 lib/cvss_suite/helpers/cvss31_helper.rb
cvss-suite-3.0.0 lib/cvss_suite/helpers/cvss31_helper.rb