KEV::Query
Inherits Indexable < Enumerable < Iterable < Enumerable < Reference < Object
Chainable filter over a list of Vulnerability records.
Each filter method returns a new Query so chains compose cleanly:
catalog.query
.vendor("Microsoft")
.ransomware
.added_on_or_after(Time.utc(2024, 1, 1))
.to_a
The query is lazy in shape (each method is just a transformation), but
eager in execution โ every step allocates an Array of the filtered
subset. For typical KEV sizes (~1.5k entries) this is fine; if you
need streaming you can drop down to vulnerabilities.each and write a
block-form filter yourself.
Constructors
Instance methods
Substring match against short_description (case-insensitive).
Keep entries due within span from now and not yet overdue. An
entry whose deadline is today still counts as upcoming โ see
Vulnerability#overdue?.
Calls the given block once for each element in self, passing that
element as a parameter.
a = ["a", "b", "c"]
a.each { |x| print x, " -- " }
produces:
a -- b -- c --
Returns the first element in the collection.
When the collection is empty, returns nil.
([1, 2, 3]).first? # => 1
([] of Int32).first? # => nil
Returns the last element of self if it's not empty, or nil.
([1, 2, 3]).last? # => 3
([] of Int32).last? # => nil
Substring match against vulnerability_name (case-insensitive).
Keep entries whose remediation deadline has already passed.
Returns the element at the given index, without doing any bounds check.
Indexable makes sure to invoke this method with index in 0...size,
so converting negative indices to positive ones is not needed here.
Clients never invoke this method directly. Instead, they access
elements with #[](index) and #[]?(index).
This method should only be directly invoked if you are absolutely sure the index is in bounds, to avoid a bounds check for a small boost of performance.