Sha256: 917f3f50cf05e383c1186f720905306a5fd50fc3421362903a3984667386cb7e

Contents?: true

Size: 746 Bytes

Versions: 6

Compression:

Stored size: 746 Bytes

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 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

6 entries across 6 versions & 1 rubygems

Version Path
cvss-suite-1.2.3 lib/cvss_suite/helpers/cvss31_helper.rb
cvss-suite-2.0.2 lib/cvss_suite/helpers/cvss31_helper.rb
cvss-suite-1.2.2 lib/cvss_suite/helpers/cvss31_helper.rb
cvss-suite-2.0.1 lib/cvss_suite/helpers/cvss31_helper.rb
cvss-suite-2.0.0 lib/cvss_suite/helpers/cvss31_helper.rb
cvss-suite-1.2.1 lib/cvss_suite/helpers/cvss31_helper.rb