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
Parse a single bare-row JSON object ({"cve": ..., "epss": ...})
into one Score. For full envelope payloads use Response.from_json.
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.
Class methods
Instance methods
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]
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.
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).
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)
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).
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.
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.
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.