KEV::Stats
Aggregate summary of a Catalog. Produced by Catalog#stats.
The struct is a snapshot — it captures the catalog state at the
moment of computation and does not track later mutations of the
underlying array. Most fields are plain counts or Hash rollups so
they print nicely and serialize without extra glue.
s = catalog.stats(top: 5)
s.total # => 1592
s.ransomware # => 321
s.top_vendors # => [{"Microsoft", 320}, {"Cisco", 78}, ...]
s.by_year # => {2024 => 187, 2025 => 142, ...}
Constructors
Build a Stats from a Catalog in one pass. Callers usually go
through Catalog#stats(top:, now:) rather than calling this
directly.
Instance methods
Appends this struct's name and instance variables names and values to the given IO.
struct Point
def initialize(@x : Int32, @y : Int32)
end
end
p1 = Point.new 1, 2
p1.to_s # "Point(@x=1, @y=2)"
p1.inspect # "Point(@x=1, @y=2)"
How many entries' remediation deadlines have passed (relative to
the now argument passed to Catalog#stats).
Top CWEs by occurrence, descending. A vulnerability with N CWEs
contributes to N CWE buckets. Bounded by top.
Top vendors by entry count, descending. The length is bounded by
the top argument to Catalog#stats (default 5).