module CvssSuite::Cvss31Helper

This module includes methods which are used by the CVSS 3 classes.

Public Class Methods

round_up(float) click to toggle source

Since CVSS 3 all float values are rounded up, therefore this method is used instead of the mathematically correct method round().

# File lib/cvss_suite/helpers/cvss31_helper.rb, line 18
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