struct

KEV::Stats

Inherits Struct < Value < Object

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

compute(catalog : Catalog, top : Int32 = 5, now : Time = Time.utc) : Stats

Build a Stats from a Catalog in one pass. Callers usually go through Catalog#stats(top:, now:) rather than calling this directly.

Source
new(total : Int32, ransomware : Int32, overdue : Int32, by_year : Hash(Int32, Int32), top_vendors : Array(Tuple(String, Int32)), top_products : Array(Tuple(String, Int32)), top_cwes : Array(Tuple(String, Int32)), as_of : Time)
Source

Instance methods

as_of

The Time baseline used for the overdue calculation.

Source
by_year

cve_year => count of entries with that year segment.

Source
inspect(io : IO) : Nil

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)"
Source
overdue

How many entries' remediation deadlines have passed (relative to the now argument passed to Catalog#stats).

Source
ransomware

How many entries carry knownRansomwareCampaignUse: "Known".

Source
top_cwes

Top CWEs by occurrence, descending. A vulnerability with N CWEs contributes to N CWE buckets. Bounded by top.

Source
top_products

Top products by entry count, descending. Bounded by top.

Source
top_vendors

Top vendors by entry count, descending. The length is bounded by the top argument to Catalog#stats (default 5).

Source
total

Total number of entries.

Source