struct

EPSS::Score

Inherits Comparable < Struct < Value < Object

A single EPSS measurement for one CVE on one date.

Every field returned by the FIRST API and the daily CSV feed is captured here. Scores are Comparable by their EPSS probability so collections can be sorted directly:

scores.sort.last      # highest-probability CVE
scores.max_by(&.epss) # equivalent

== and #hash are structural across all fields (cve + date + values), so two Score objects from different snapshots of the same CVE are not equal — this is intentional, since EPSS values move daily and dedup by CVE alone would silently merge them.

Constructors

from_json(input : String | IO) : Score

Parse a single bare-row JSON object ({"cve": ..., "epss": ...}) into one Score. For full envelope payloads use Response.from_json.

Source
from_row(cve : String, epss, percentile, date = nil) : Score

Build a Score from a raw API/CSV row hash-like object. Values may be supplied as either strings (the API and CSV both return strings) or already-parsed numerics.

Source
new(cve : String, epss : Float64, percentile : Float64, date : Time | Nil = nil)
Source

Class methods

from_json?(input : String | IO) : Score | Nil
Source

Instance methods

<=>(other : Score) : Int32 | Nil

The comparison operator. Returns 0 if the two objects are equal, a negative number if this object is considered less than other, a positive number if this object is considered greater than other, or nil if the two objects are not comparable.

Subclasses define this method to provide class-specific ordering.

The comparison operator is usually used to sort values:

# Sort in a descending way:
[3, 1, 2].sort { |x, y| y <=> x } # => [3, 2, 1]

# Sort in an ascending way:
[3, 1, 2].sort { |x, y| x <=> y } # => [1, 2, 3]
Source
==(other : Score) : Bool

Structural equality on every field. Overrides the == that Comparable would otherwise derive from <=> — we don't want two scores with the same EPSS probability to compare equal when their CVE / date / percentile differ.

Source
age(now : Time = Time.utc) : Time::Span | Nil

Age of this snapshot relative to now. Returns nil when the score has no associated date (e.g. CSV rows without per-row dates before the feed metadata was attached).

Source
at_least?(threshold : Band | Symbol = Band::High) : Bool

Convenience: true when the EPSS-band is at least threshold. The default of :high matches the common "operationally relevant" cutoff used by triage dashboards.

score.at_least?(:medium) # => Bool
score.at_least?(EPSS::Band::Critical)
Source
band

Band derived from the EPSS probability.

Source
critical?

true when this score's EPSS-band equals Band::Critical.

Source
cve

The CVE identifier (e.g., "CVE-2022-27225"). Normalized to upper-case.

Source
date

The date the score was generated. May be nil for CSV rows that did not carry per-row dates (the feed publishes one date at the file header — see CSV.parse).

Source
delta(other : Score) : Float64

Difference in EPSS probability against other, in the direction other → self (positive when this score is higher). Useful for daily-delta dashboards comparing two snapshots of the same CVE.

Source
epss

Exploit probability for the next 30 days, in [0.0, 1.0].

Source
hash(hasher)

See Object#hash(hasher)

Source
high?

true when this score's EPSS-band equals Band::High.

Source
low?

true when this score's EPSS-band equals Band::Low.

Source
medium?

true when this score's EPSS-band equals Band::Medium.

Source
none?

true when this score's EPSS-band equals Band::None.

Source
percentage

EPSS as a percentage in [0.0, 100.0]. Pure display helper — downstream tooling almost always renders the value multiplied by 100, and doing it inline reads better than open-coding * 100.

Source
percentile

Percentile rank within the EPSS population, in [0.0, 1.0].

Source
percentile_band

Band derived from the percentile rank.

Source
percentile_percentage

Percentile rank rendered as a percentage in [0.0, 100.0].

Source
to_json(json : JSON::Builder) : Nil
Source
to_s(io : IO) : Nil

Same as #inspect(io).

Source
to_s

Returns a nicely readable and concise string representation of this object, typically intended for users.

This method should usually not be overridden. It delegates to #to_s(IO) which can be overridden for custom implementations.

Also see #inspect.

Source