class

Feed::Backend::Criteria

Inherits Feed::Backend < Reference < Object

A criteria judge.

An object is judged against structured criteria carried in the feed's params, organized into groups: keywords (matched by case-insensitive substring over the object's HTML-stripped content and summary and its plain-text name) and hashtags (matched by exact, case-insensitive equality against the object's hashtag names) and mentions (matched by qualified, case-insensitive handle or by actor IRI). Each group carries any/all/none term lists. Terms are evaluated together: an object is in when at least one positive term matches (and every all term matches) and no none term matches. Exclusion always wins, across groups.

Constants

GROUPS = [Keywords.new, Hashtags.new, Mentions.new] of Group
ORDER = "order"
POSITIVE = ["any", "all"] of ::String
SELECTORS = ["any", "all", "none"] of ::String

Class methods

iri_term?(term : String) : Bool

Distinguishes an IRI term from a handle.

Source

Instance methods

judge(feed : Feed, objects : Array(ActivityPub::Object)) : Array(Judgment)

Judges a batch of objects for a feed.

Returns one Judgment per object, in the same order.

Source
judging_params(params : Hash(String, JSON::Any)) : Hash(String, JSON::Any)

Sorts every group's selectors' term list.

Drops the entry order.

Source
validate_params(params : Hash(String, JSON::Any)) : Array(String)

Validates a feed's backend-owned params.

Returns error messages -- empty if the params are valid. Each message should be a complete sentence and is rendered verbatim.

Source

Nested types